我使用Mabe Plugin for Netbeans(v4.20.1)在Netbeans 7.3中创建了一个maven项目
在我的pom.xml中,我尝试明确定义surefire插件,但无论我做什么,它都从不接受它。它正在拉不同版本的万无一失(2.10),我不知道从哪里来。 pom.xml中的所有其他插件都按预期工作。有线索吗?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>myGroup</groupId>
<artifactId>myArtifact</artifactId>
<version>myVersion</version>
<packaging>jar</packaging>
<name>myName</name>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.build.timestamp.format>yyyy-MM-dd_HH:mm</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<!-- This invalid version should trigger a maven error, but doesn't -->
<version>92.14</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<!--etc...-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<!--etc...-->
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>windows</id>
<activation>
<activeByDefault>true</activeByDefault>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<!--etc...-->
</properties>
</profile>
<profile>
<id>linux</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<!--etc...-->
</properties>
</profile>
</profiles>
</project>
答案 0 :(得分:2)
您引用的工件(org.apache.maven.surefire:surefire
)不是插件,而是POM。
您应该使用以下内容更改声明:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
...
</plugin>