10

親 pom と 2 つのモジュール pom があります。最初のモジュールでは、2 番目のモジュール (jar) をいくつかのフォルダーにコピーします。最初のモジュール pom からプロジェクトをコンパイルすると動作しますが、親プロジェクトの pom からコンパイルしようとすると、プラグインは jar の insted モジュール クラスをコピーしようとします。

[エラー] プロジェクト module1 で目標 org.apache.maven.plugins:maven-dependency-plugin:2.1:copy (default) を実行できませんでした: /home/chardex/projects/test/module2/target/classes からアーティファクトをコピー中にエラーが発生しました/home/chardex/projects/test/module1/target/lib/classes: /home/chardex/projects/test/module2/target/classes (ディレクトリです) -> [ヘルプ 1]

   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <phase>compile</phase>
                <goals>
                    <goal>copy</goal>
                </goals>
                <configuration>
                    <artifactItems>            
                        <artifactItem>
                            <groupId>...</groupId>
                            <artifactId>module2</artifactId>
                            <version>...</version>
                            <type>jar</type>
                        </artifactItem>
                    </artifactItems>
                </configuration>
            </execution>
        </executions>
    </plugin>

ありがとう。

4

3 に答える 3

9

これは maven-dependency-plugin のバグだと思います: http://jira.codehaus.org/browse/MDEP-259

于 2011-10-24T15:28:51.003 に答える
1

これをEclipseで実行しているときに、「Resolve workspace artifacts」のチェックを外すとエラーが解消され、クリーンインストールを正常に実行できました。

于 2015-10-16T04:36:45.080 に答える
0

pom で Eclipse ライフサイクル マッピングを使用しているかどうかを確認し、使用している場合は、プラグインのバージョンを確認します。私にとっては、コマンドライン maven で使用される 2.0 ではなく、maven-dependency-plugin 2.1 (バグ) でした。

    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.apache.maven.plugins
                                    </groupId>
                                    <artifactId>
                                        maven-dependency-plugin
                                    </artifactId>
                                    <versionRange>
                                        [2.0,2.0.8) <!-- 2.1 fails the build due to the http://jira.codehaus.org/browse/MDEP-187 -->
                                    </versionRange>
                                    <goals>
                                        <goal>
                                            copy-dependencies
                                        </goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute/>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
于 2012-08-23T12:57:01.083 に答える