今天就跟大家聊聊有关maven-antrun-plugin中无法调用 jsch shell target该怎么办,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
从策划到设计制作,每一步都追求做到细腻,制作可持续发展的企业网站。为客户提供成都做网站、网站制作、成都外贸网站建设、网站策划、网页设计、申请域名、虚拟主机、网络营销、VI设计、 网站改版、漏洞修补等服务。为客户提供更好的一站式互联网解决方案,以客户的口碑塑造优易品牌,携手广大客户,共同发展进步。
将Maven项目的一键部署从原来的http上传改为:
compile的时候连接linux,关闭tomcat,删除logs、work,再启动tomcat,最后打包部署。
考虑了采用maven-antrun-plugin插件,但是开始一直报错,找不到jsch这些jar,但是单独运行build.xml又是好的。后来干脆直接在build.xml里面引入jar了,解决问题了,配置文件如下:
Pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>compile</id> <phase>compile</phase> <configuration> <target> <ant antfile="${basedir}/build.xml"> <target name="test"/> </ant> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
build.xml
<?xml version="1.0" ?> <project name ="DKSNS-Java-Pro" default ="test" basedir ="."> <property environment="env"/> <target name="test"> <echo message="compile classpath: ${env.ANT_HOME}"/> <path id="jsch.path"> <pathelement location="${env.ANT_HOME}\lib\ant-jsch.jar" /> <pathelement location="${env.ANT_HOME}\lib\jsch-20130131.jar" /> </path> <!-- <taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" classpathref="jsch.path" /> --> <taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jsch.path" /> <sshexec host="192.168.81.132" username="root" password="123456" trust="true" command="cd /usr/local/tomcat/bin; ./shutdown.sh; cd /usr/local/tomcat/logs; rm -rf *; cd /usr/local/tomcat/work; rm -rf *;"> </sshexec> </target> </project>
看完上述内容,你们对maven-antrun-plugin中无法调用 jsch shell target该怎么办有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
本文标题:maven-antrun-plugin中无法调用jschshelltarget该怎么办
标题来源:https://www.cdcxhl.com/article4/joceoe.html
成都网站建设公司_创新互联,为您提供网页设计公司、手机网站建设、静态网站、建站公司、网站改版、微信公众号
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联