Jenkins Maven处理

今天让maven来跑我的自动化脚本,先是本地运行,然后想用jenkins跑。

结果本地就悲剧了。

出了这个错

 

源文档 <http://write.blog.csdn.net/postedit>

 

 

[ERROR] Failed toexecute goal org.apache.maven.plugins:maven-surefire-plugin:2.

12.4:test(default-test) on project fabu: Execution default-test of goal org.apa

che.maven.plugins:maven-surefire-plugin:2.12.4:testfailed: The forked VM termin

ated without sayingproperly goodbye. VM crash or System.exit called ? -> [Help

1]

 

可能的原因: 有可能你在使用的版本是maven3.X,其执行maven-ant-plugin的行为和maven2.x有一定的不同,需要引入pluginManagement

 

解决办法是:在pom.xml中引入:<pluginManagement></pluginManagement>

 

之前的内容:

 <build>

  <plugins>

     <plugin></plugin>

     ...

      <plugin></plugin>

   </plugins>

</build>

修改后的内容:

 <build>

   <pluginManagement>

   <plugins>

     <plugin></plugin>

     ...

      <plugin></plugin>

   </plugins>

</pluginManagement>

</build>

 

源文档 <http://www.iteye.com/topic/1130926>

 

   <build>

       <defaultGoal>install</defaultGoal>

        <plugins>

            <plugin>

               <groupId>org.apache.maven.plugins</groupId>

               <artifactId>maven-surefire-plugin</artifactId>

               <version>2.9</version>

                <configuration>

                    <includes>

                       <include>**/*Test.java</include>

                    </includes>

                    <excludes>

                       <exclude>**/Abstract*.java</exclude>

                       <exclude>**/Add*.java</exclude>

                       <exclude>**/*UserTest.java</exclude>

                       <exclude>**/LaunchBackendTest.java</exclude>>

                    </excludes>

                </configuration>

            </plugin>

        </plugins>

        <resources>

            <resource>

               <directory>src/main/resources</directory>

            </resource>

        </resources>

        <testResources>

            <testResource>

               <directory>src/test/resources</directory>

            </testResource>

        </testResources>

    </build>

 

 

Tests run: 0,Failures: 0, Errors: 0, Skipped: 0

 

[INFO]------------------------------------------------

[INFO] BUILD SUCCESS

[INFO]------------------------------------------------

[INFO] Total time:1.183 s

[INFO] Finished at:2014-06-17T10:34:30+08:00

[INFO] Final Memory:10M/111M

[INFO]------------------------------------------------

结果是看到有跑,但是没有包跑过

To run a single testmethod in Maven, you need to provide the command as:

mvn-Dtest=TestCircle#xyz test

 

源文档 <http://stackoverflow.com/questions/1873995/run-a-single-test-method-with-maven>

 

试了好多,还是没有成功

然后把pom文件替换成以前成功的。

结果又出现个这个错误:

 

[ERROR] Failed toexecute goal org.apache.maven.plugins:maven-compiler-plugin:2.

5.1:testCompile(default-testCompile) on project fabu: Compilation failure: Comp

ilation failure:

[ERROR]D:\eclipsecode\fabu\src\test\java\com\fabu\testAaa.java:[5,0] 错误: 程序

包org.junit不存在

但是以前的却能跑,发现我的代码需要依靠junit那个包。

lily跟我说,导入的包有问题。

然后我重新建立Maven工程,把写好的代码copy过来,结果跑成功了。

 

然后想导入到Jenkins中,发现安装插件多么的不给力,网络全被墙了。

下了好久没结果,放弃了。

后面想,我本地跑。

先是看这下面的文章

http://wxynxyo.iteye.com/blog/1902240

但是运行总出错,似乎pom配置有问题。

然后我把pom复制到c:\jenkins下,还是没解决这个问题

在看了这篇文章以后

http://www.myexception.cn/cvs-svn/1508681.html

把pom的路径指定,结果成功了。

 

现在看看哪些需要配置的。


还有pom,费了好久的

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值