Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-dependency-plugin:copy tries to copy classes

I have parent pom and two module poms. In first module I want to copy second module (jar) to some folder. When I compiling project from first module pom - it works, but when I'm trying to compile from parent project pom, plugin tries to copy module classes insted of jar:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.1:copy (default) on project module1: Error copying artifact from /home/chardex/projects/test/module2/target/classes to /home/chardex/projects/test/module1/target/lib/classes: /home/chardex/projects/test/module2/target/classes (Is a directory) -> [Help 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>

Thanks.

like image 320
chardex Avatar asked Dec 28 '10 12:12

chardex


People also ask

How does Maven resolve transitive dependencies?

Transitive Dependencies. Maven avoids the need to discover and specify the libraries that your own dependencies require by including transitive dependencies automatically. This feature is facilitated by reading the project files of your dependencies from the remote repositories specified.

What is ArtifactItem?

ArtifactItem represents information specified in the plugin configuration section for each artifact.

What is Maven clean plugin?

The Maven Clean Plugin, as the name implies, attempts to clean the files and directories generated by Maven during its build. While there are plugins that generate additional files, the Clean Plugin assumes that these files are generated inside the target directory.


2 Answers

I believe this is a bug in maven-dependency-plugin: http://jira.codehaus.org/browse/MDEP-259

like image 125
Gili Avatar answered Sep 30 '22 00:09

Gili


While doing this in eclipse, unchecking the "Resolve workspace artifacts" got rid of the error, and I could do a clean install successfully.

like image 28
Bhavin Doshi Avatar answered Sep 30 '22 00:09

Bhavin Doshi