Maven构建错误 - 无法执行目标org.apache.maven.plugins:maven-dependency-plugin:2.8:copy(copy)

时间:2017-06-26 08:13:28

标签: java eclipse maven

当我尝试执行命令mvn -clean install时,我收到以下构建错误

[错误]无法执行目标org.apache.maven.plugins:maven-dependency-plugin:2.8:复制(复制)项目fxquotelogger:无法解析mojo的配置org.apache.maven.plugins:maven- dependency-plugin:2.8:copy for parameter artifactItem:无法在org.apache.maven.plugin.dependency.fromConfiguration.ArtifactItem中找到setter,adder和field for'overprite' - > [帮助1]

这就是我在pom.xml中对上述错误的贡献

<pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.7</version>
                    <executions>
                        <execution>
                            <id>copy</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>copy</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>com.google.guava</groupId>
                                        <artifactId>guava</artifactId>
                                        <version>21.0</version>
                                        <type>jar</type>
                                        <overwrite>false</overwrite>
                                        <outputDirectory>${project.build.directory}/payload/temp/portware.dir.root/lib/external.war</outputDirectory>
                                        <destFileName>guava.jar</destFileName>
                                        <overWriteReleases>false</overWriteReleases>
                                        <overWriteSnapshots>true</overWriteSnapshots>
                                        <stripVersion>true</stripVersion>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

编辑:

除了上述错误,我在eclipse中看到“执行”的错误如下

无法为插件执行副本获取参数artifactItems的值(org.apache.maven.plugins:maven-dependency-plugin:3.0.1:copy:copy:package)

org.eclipse.core.runtime.CoreException:无法为插件执行副本获取参数artifactItems的值     在org.eclipse.m2e.core.internal.embedder.MavenImpl.getMojoParameterValue(MavenImpl.java:950)     在org.eclipse.m2e.core.internal.embedder.MavenImpl $ 6.call(MavenImpl.java:959)     在org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)     在org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)     在org.eclipse.m2e.core.internal.embedder.MavenImpl.getMojoParameterValue(MavenImpl.java:957)     at com.coderplus.utils.BuildHelper.processCopyOrUnpack(BuildHelper.java:166)     在com.ianbrandt.tools.m2e.mdp.core.MdpBuildParticipant.build(MdpBuildParticipant.java:63)     在org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)     在org.eclipse.m2e.core.internal.builder.MavenBuilder $ 1.method(MavenBuilder.java:172)     在org.eclipse.m2e.core.internal.builder.MavenBuilder $ 1.method(MavenBuilder.java:1)     在org.eclipse.m2e.core.internal.builder.MavenBuilder $ BuildMethod $ 1 $ 1.call(MavenBuilder.java:115)     在

编辑2:现在已经解决了。我不得不关闭overWriteReleases上面的artifactItem和artifactItems

1 个答案:

答案 0 :(得分:1)

所有,我自己能够解决此问题。 <executions>标记在启动<configuration>标记之前已关闭。

这是该块想要的。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.0.1</version>
    <executions>
        <execution>
            <id>copy</id>
            <phase>process-resources</phase>
            <goals>
                <goal>copy</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <artifactItems>
            <artifactItem>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>19.0</version>
                <type>jar</type>
                <overWrite>false</overWrite>
                <outputDirectory>${project.build.directory}/payload/temp/portware.dir.root/lib/external.war</outputDirectory>
                <destFileName>guava.jar</destFileName>
            </artifactItem>
        </artifactItems>
        <overWriteReleases>false</overWriteReleases>
        <overWriteSnapshots>true</overWriteSnapshots>
        <!-- <stripVersion>true</stripVersion> -->
    </configuration>
</plugin>