- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过在 Jenkins 的作业中使用 maven antrun 插件来启动 Tomcat。我知道我可以使用 cargo 来做同样的事情,但我不能使用它。原因是我希望 Tomcat 在构建结束后运行应用程序。
场景如下 - 我有作业 1,它 checkout 一个项目 -> 构建它 -> 在 Tomcat 上部署它。另一个工作说 Job 2 检查另一个项目->构建并将其部署在 ESB 上,然后使用部署在 Job 1 上的 Tomcat 运行集成测试。我需要在作业 1 中停止 Tomcat 一次,这是我在清理阶段使用 cargo:stop 实现的——然后我计划在编译阶段后使用 maven antrun 启动它。然后再次使用 cargo 重新部署 package 阶段后的新 war。我需要这样做,以便为每个测试构建刷新 Tomcat,并且不会受到 Permgen 等问题的影响。
无论如何,问题是我的以下脚本在我的命令提示符下运行良好,即它可以正常启动 Tomcat 并为 Startup.bat 打开一个命令窗口。但是当我在 Jenkins 中尝试相同的操作时,它没有被执行并且足够有趣它不会提示 - 简单不会启动 tomcat。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>startTomcat</id>
<phase>compile</phase>
<configuration>
<target>
<exec executable="C:\Windows\System32\cmd.exe" spawn="true">
<arg value="/c" />
<arg value="D:\apache-tomcat-6.0.36\bin\startup.bat" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
这是我在jenkins看到的日志
[INFO] Executing tasks
Build sequence for target(s) `main' is [main]
Complete build sequence is [main, ]
main:
[exec] Current OS is Windows 7
[exec] Executing 'C:\Windows\System32\cmd.exe' with arguments:
[exec] '/c'
[exec] 'D:\apache-tomcat-6.0.36\bin\startup.bat'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'C:\Windows\System32\cmd.exe' with arguments:
'/c'
'D:\apache-tomcat-6.0.36\bin\startup.bat'
The ' characters around the executable and arguments are
not part of the command.
spawned process java.lang.ProcessImpl@ed11c1
[INFO] Executed tasks
mojoSucceeded org.apache.maven.plugins:maven-antrun-plugin:1.7(startTomcat)
我已经尝试了 executable="C:\Windows\System32\cmd.exe"以及 executable="cmd.exe"- 同样的问题,即当从命令提示符运行时它工作正常但在 jenkins 中这不是启动 tomcat 并且都没有错误。
已检查 Jenkins - 系统配置和 user.name 是 NEW-LT7-0064$。不确定这是否有任何帮助,但是当我从命令提示符运行时,用户是我的 Windows 登录用户。我还使用本地系统帐户将 Jenkins 作为 Windows 服务运行。
我尝试了以下以及链接中建议的 https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build这在 Windows 64 位 Windows 7 机器上都不起作用
Another workaraund for Windows XP and later is to shedule permanent task and force running it from the ant script.
Once run the command:
C:\>SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN Tomcat /TR "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\startup.bat"
Note, that ONSTART can be replaced with ONCE if you do not want to keep Tomcat running.
Add the following code to your ant script:
<exec executable="SCHTASKS">
<arg value="/Run"/>
<arg value="/TN"/>
<arg value="Tomcat"/>
</exec>
最佳答案
你确定tomcat根本没有启动吗? IIRC Jenkins 不支持生成长期存在的构建过程(参见 here )。
关于tomcat second comment可能会有帮助:将 tomcat 作为服务而不是使用 shell 脚本启动。
关于tomcat - Jenkins 没有通过 maven-antrun 运行 Catalina.bat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13881255/
我正在使用 Maven AntRun 插件 1.6 并且从他们的示例中我无法编写以下要执行的 ant 任务。 示例网址:http://maven.apache.org/plugins/maven-an
按照使用页面上的说明 (http://maven.apache.org/plugins/maven-antrun-plugin/usage.html) 和其他 Stackoverflow 问题,我
antrun 正在使用哪个版本的 ANT插件以及如何控制它以使用特定版本的 ANT 发行版。这个插件真的从本地发行版中获取 ANT 吗? 最佳答案 根据 Maven Central 中的信息,它使用的
我正在尝试使用 maven-antrun-plugin复制生成的.java文件到我当前的源目录。我的问题是生成了我要复制的路径目录的一部分。 我要复制的路径是这样的: ${project.build.
我正在将 ant 脚本转换为 Maven,并决定使用 Maven ant run 插件。我走的很好,但我遇到了以下问题。 Ant源脚本使用目标定义如下: 重点是使
我试图将Maven属性(通过配置文件定义)传递给antrun执行: org.apache.maven.plugins maven-antrun-plugin 1.7
我的 pom 中有以下内容: org.apache.maven.plugins maven-ant-plugin 2.3
我正在尝试设置 Maven 以在我的 Web 项目中的目录上执行 LESS CSS 预处理器。基本流程是: Maven 调用 maven-antrun-plugin。 Ant-contrib 循环遍历
如何禁用 maven-antrun-plugin当某个文件已经存在时执行?: [...] maven-antrun-plugin 1.6 test
我正在学习如何将 maven 用于我的独立 Java 应用程序,但我不明白如何将所有目录从/src/main/resources 递归复制到/taget 目录。 我尝试使用 antrun 和资源插件,
有一个多模块项目。在 child 内部,我需要做一些复杂的事情(集成测试与部署到应用程序服务器等)。所以有一个集成测试子模块,从这个模块我需要父模块的根才能到达其他模块。我不想使用“..”。 Inte
我想根据文件的可用性在 antrun 插件中执行“javac”。我们如何在 maven-antrun 插件中添加条件。 最佳答案 您可以在 Maven AntRun Plugin 的帮助下完成此操作.
我们在将 Ear 部署到服务器时遇到问题。不同环境(dev、int、acc等)的部署是有区别的。对于每个环境,我们部署到 1 个 weblogic 服务器。在某些情况下,还需要在第二台服务器上进行部署
我在我的 Maven 构建中使用 antrun 插件来替换 token @版本@ 在一些带有应用程序版本的 JSP 文件中。 这就是我正在做的: maven-antrun-plugin
我试图检查并查看是否在 maven-antrun-plugin 中设置了 MULE_HOME 环境变量但没有成功。这是我到目前为止所拥有的: org.apache.maven
我可以通过以下方式将两个属性 A 和 B 传递给 maven mvn test -DA=true 或 mvn test -DB=true 如果定义了 A 或 B,我希望跳过目标。我发现只有 A 被
如何从 maven-antrun-plugin 获取信息回到 Maven 脚本?例如: [...] maven-antrun-plugin 1.6 test
我正在使用 maven-antrun-plugin 生成使用 Apache Thrift 的类。当我将一个 thrift 文件指定为参数时该插件工作,但当我尝试使用通配符 (*) 为所有 thrift
我正在 Maven 中的 Ant 任务中复制一些文件,但我不知道如何告诉 ant 不要记录它正在复制一些文件的事实。 org.apache.maven.plugins maven-a
我已经将 jquery-ui 下载到我的 webapp 中,它有一个 build.xml用于压缩和缩小。 现在我想运行这个 build.xml来自我的 pom.xml : org.apa
我是一名优秀的程序员,十分优秀!