我在 Netbeans 中编写了我的 maven 项目。我为我的项目(dao、service..)编写了测试。所有测试都是正确的,但是当我构建或测试我的项目时,maven 显示没有要编译的测试。我使用的是 maven-surefire-plugin,所以将它包含到 pom.xml 中:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.10</version>
</dependency>
</dependencies>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
</configuration>
我认为surefire插件有问题..
那是:
Scanning for projects...
------------------------------------------------------------------------
Building Employeers 1.0.0-BUILD-SNAPSHOT
------------------------------------------------------------------------
[aspectj:compile]
[resources:resources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 4 resources
[compiler:compile]
Nothing to compile - all classes are up to date
[aspectj:test-compile]
[resources:testResources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource
[compiler:testCompile]
Nothing to compile - all classes are up to date
[surefire:test]
Surefire report directory: C:\Users\Администратор\Documents\NetBeansProjects\Employeers\target\surefire-reports
Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Error: An unexpected error occurred while trying to open file C:\Users\?????????????\Documents\NetBeansProjects\Employeers\target\surefire\surefirebooter472050683580306804.jar
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[war:war]
Packaging webapp
Assembling webapp [Employeers] in [C:\Users\Администратор\Documents\NetBeansProjects\Employeers\target\Employeers-1.0.0-BUILD-SNAPSHOT]
Processing war project
Copying webapp resources [C:\Users\Администратор\Documents\NetBeansProjects\Employeers\src\main\webapp]
Webapp assembled in [590 msecs]
Building war: C:\Users\Администратор\Documents\NetBeansProjects\Employeers\target\Employees.war
Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 5.258s
Finished at: Fri Jul 27 19:47:07 EEST 2012
Final Memory: 6M/16M
------------------------------------------------------------------------