1

I'm trying to set up a project to run junit tests at build time, so that every member of the team and the Jenkins build server runs the tests when it builds.

I believe we have set up a fairly standard webproject in Netbeans, but I can't seem to find anyone solving this problem on stackoverflow or google.

How would you go about doing this?

4

2 回答 2

1

转到文件:/nbproject/build-impl.xml 并找到 dist 目标。它应该如下所示:

<target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/>

将其复制粘贴到 /build.xml 中,并将“测试”目标添加到其中:

<target depends="init,compile,test,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/>

这是在 Netbeans 7.3 中。它现在在每个构建上构建并运行测试,也在 Jenkins 构建服务器上。

于 2013-11-02T16:31:10.800 回答
1

永远不要修改你的 build-impl.xml!当您对项目执行任何更改时,Netbeans 会重新生成此文件。

更好的方法是修改您的 build.xml 并添加一个 post-jar 任务:

<target name="-post-jar" depends="test"/>
于 2017-03-09T06:54:49.057 回答