Greetings.

 

I have a very specific need in a java project in Eclipse: The jars which
the project depends on must be copied to an external folder.

 

The maven-dependency-plugin and its copy-dependencies goal come to mind
immediately.

 

As a test, I wrote the following pom.xml:

 

-----

<project ...>

            ...

            <build>

                        ...

                        <plugins>

                                   ...

                                   <plugin>

 
<groupId>org.apache.maven.plugins</groupId>

 
<artifactId>maven-dependency-plugin</artifactId>

                                               <executions>

                                                           <execution>

 
<id>copy-dependencies</id>

 
<phase>process-resources</phase>

 
<goals>

 
<goal>copy-dependencies</goal>

 
</goals>

 
<configuration>

 
<outputDirectory>${my.external.location}/alterloc</outputDirectory>

 
<excludeArtifactIds>servlet-api</excludeArtifactIds>

 
</configuration>

                                                           </execution>

                                               </executions>

                                   </plugin>

                        </plugins>

            </build>

</project>

-----

 

However, the above pom shows some bogus behavior, depending on the user
action:

1)                    Right-clicking the project and selecting "Maven >
Update Project Configuration": The folder "alterloc" is created in
"my.external.location", and the jars, but servlet-api, are copied to it
- Just as expected.

2)                    Compiling the project: The folder "dependency" is
created in "project.build.directory", and the jars, including
servlet-api, are copied to it - Not expected, once the configurations
seems to be ignored

 

I already tried to change the phase to "compile", to "process-classes",
but in that case it's even worst: The dependencies wasn't copied at all.

 

What am I doing wrong?

 

Thanks in advance

 

 

Luciano Mantuaneli   <http://www.linkedin.com/in/lucianomantuaneli> 

 

TI Melhorias - Suporte a Canais

 

CPM Braxis

Cel: 55 11 8399 0319

Tel: 55 11 4196 4622

www.cpm.com.br <http://www.cpm.com.br> 

www.cpminternational.com <http://www.cpminternational.com> 

www.braxis.com.br <http://www.braxis.com.br> 

 

Reply via email to