You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lucas Persson <lu...@oracle.com> on 2011/04/08 09:28:46 UTC
maven-dependency-plugin uses target dir instead of artifacts from
repository
Hi
I have some issues with the maven-dependency-plugin vers 2.2 under Maven3.
In one project I uses the plugin to unpack a sources artifact like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-artifact-sources</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>oracle.ucs.callcontrol</groupId>
<artifactId>callcontrolapi</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
This works very well when doing e.g. 'mvn install'
But when runnning e.g. mvn pmd:pmd on the parent project (which also
builds the artifact that this project tries to unpack)
then the maven-dependency-plugin uses that project's target dir instead
taking the sources jar form the repository.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/target/unpack-sources
This is very strange.
Anyone with similar experience?
Thanks
Lucas
--
Oracle <http://www.oracle.com>
Lucas Persson | Principal Member of Technical Staff
Phone: +4684773644 <tel:+4684773644> | | | Mobile: +46730946656
<tel:+46730946656>
Oracle Communications Platform
ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
Re: maven-dependency-plugin uses target dir instead of artifacts
from repository
Posted by Lucas Persson <lu...@oracle.com>.
Thanks Anders
I note I get the same issue for mvn site when the reports shall be
generated.
I can understand that during a reactor build artifacts shall be fetched
from the build but it does not make scenes that the plugin tries to use
target/classes when I specified a source classifier.
Well I think I perhaps missuse maven here so I need to come up with a
better solution.
Cheers
Lucas
On 04/08/2011 09:56 AM, Anders Hammar wrote:
> I believe I've run into a similar issue at some time.
> However, there are a few things you should understand:
> 1. An reactor build is executed and for that to work, Maven *should*
> get artifacts from the reactor and not the repo
> 2. executing "mvn pmd:pmd" will not install any artifacts to the local
> repository - the build lifecycle is *not* executed
>
> I think I basically gave up on this as I kind of think it's a hack
> reusing the sources from a different project. And it wasn't really my
> problem/project, so I told them to refactor instead. :-)
> I think that the jira ticket I filed for this is MDEP-291.
>
> /Anders
>
> On Fri, Apr 8, 2011 at 09:28, Lucas Persson <lucas.persson@oracle.com
> <ma...@oracle.com>> wrote:
>
> Hi
>
>
> I have some issues with the maven-dependency-plugin vers 2.2 under
> Maven3.
>
> In one project I uses the plugin to unpack a sources artifact like
> this:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack-artifact-sources</id>
> <phase>generate-resources</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>oracle.ucs.callcontrol</groupId>
> <artifactId>callcontrolapi</artifactId>
> <version>${project.version}</version>
> <classifier>sources</classifier>
> <overWrite>true</overWrite>
> </artifactItem>
> </artifactItems>
>
> <outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> This works very well when doing e.g. 'mvn install'
> But when runnning e.g. mvn pmd:pmd on the parent project (which
> also builds the artifact that this project tries to unpack)
> then the maven-dependency-plugin uses that project's target dir
> instead taking the sources jar form the repository.
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/target/unpack-sources
>
>
> This is very strange.
>
> Anyone with similar experience?
>
> Thanks
> Lucas
>
>
> --
> Oracle <http://www.oracle.com>
> Lucas Persson | Principal Member of Technical Staff
> Phone: +4684773644 <tel:+4684773644> | | | Mobile: +46730946656
> <tel:+46730946656>
> Oracle Communications Platform
> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>
> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no
> <http://reg.no>. 556254-6746
> Green Oracle <http://www.oracle.com/commitment> Oracle is
> committed to developing practices and products that help protect
> the environment
>
>
--
Oracle <http://www.oracle.com>
Lucas Persson | Principal Member of Technical Staff
Phone: +4684773644 <tel:+4684773644> | | | Mobile: +46730946656
<tel:+46730946656>
Oracle Communications Platform
ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
Re: maven-dependency-plugin uses target dir instead of artifacts from repository
Posted by Brian Fox <br...@infinity.nu>.
mvn site runs up to the test phase, it doesn't run the package phase, so
that's why you get just target/classes
On Mon, Apr 11, 2011 at 1:39 AM, Lucas Persson <lu...@oracle.com>wrote:
> But when I do mvn install on the multiprojet then I will get a JAR but
> when doing mvn site on the multiproject I get target/classes.
>
> That seems to be the opposite to what you have described?
>
> /Lucas
>
>
> On 04/08/2011 07:52 PM, Brian Fox wrote:
>
> It's not a hack, the plugin asks maven core to resolve the artifacts and the
> objects it gets back have file handles. In reactor builds with sibling
> dependencies, those handles point to the sibling target folder. If you do a
> compile reactor build, those handles will point to the /target/classes
> folder. IOW, this is Maven Core behavior, not the plugin.
>
> On Fri, Apr 8, 2011 at 3:56 AM, Anders Hammar <an...@hammar.net> <an...@hammar.net> wrote:
>
>
> I believe I've run into a similar issue at some time.
> However, there are a few things you should understand:
> 1. An reactor build is executed and for that to work, Maven *should* get
> artifacts from the reactor and not the repo
> 2. executing "mvn pmd:pmd" will not install any artifacts to the local
> repository - the build lifecycle is *not* executed
>
> I think I basically gave up on this as I kind of think it's a hack reusing
> the sources from a different project. And it wasn't really my
> problem/project, so I told them to refactor instead. :-)
> I think that the jira ticket I filed for this is MDEP-291.
>
> /Anders
>
>
> On Fri, Apr 8, 2011 at 09:28, Lucas Persson <lu...@oracle.com> <lu...@oracle.com>wrote:
>
>
> Hi
>
>
> I have some issues with the maven-dependency-plugin vers 2.2 under
> Maven3.
>
> In one project I uses the plugin to unpack a sources artifact like this:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack-artifact-sources</id>
> <phase>generate-resources</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>oracle.ucs.callcontrol</groupId>
> <artifactId>callcontrolapi</artifactId>
> <version>${project.version}</version>
> <classifier>sources</classifier>
> <overWrite>true</overWrite>
> </artifactItem>
> </artifactItems>
>
> <outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> This works very well when doing e.g. 'mvn install'
> But when runnning e.g. mvn pmd:pmd on the parent project (which also
> builds the artifact that this project tries to unpack)
> then the maven-dependency-plugin uses that project's target dir instead
> taking the sources jar form the repository.
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/
> target/unpack-sources
>
>
> This is very strange.
>
> Anyone with similar experience?
>
> Thanks
> Lucas
>
>
> --
> [image: Oracle] <http://www.oracle.com> <http://www.oracle.com>
>
> Lucas Persson | Principal Member of Technical Staff
> Phone: +4684773644 | | | Mobile: +46730946656
> Oracle Communications Platform
> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>
> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no
> . 556254-6746
> [image: Green Oracle] <http://www.oracle.com/commitment> <http://www.oracle.com/commitment> Oracle is
> committed to developing practices and products that help protect the
> environment
>
>
>
>
> --
> [image: Oracle] <http://www.oracle.com>
> Lucas Persson | Principal Member of Technical Staff
> Phone: +4684773644 | | | Mobile: +46730946656
> Oracle Communications Platform
> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>
> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
> [image: Green Oracle] <http://www.oracle.com/commitment> Oracle is
> committed to developing practices and products that help protect the
> environment
>
Re: maven-dependency-plugin uses target dir instead of artifacts
from repository
Posted by Lucas Persson <lu...@oracle.com>.
But when I do mvn install on the multiprojet then I will get a JAR but
when doing mvn site on the multiproject I get target/classes.
That seems to be the opposite to what you have described?
/Lucas
On 04/08/2011 07:52 PM, Brian Fox wrote:
> It's not a hack, the plugin asks maven core to resolve the artifacts and the
> objects it gets back have file handles. In reactor builds with sibling
> dependencies, those handles point to the sibling target folder. If you do a
> compile reactor build, those handles will point to the /target/classes
> folder. IOW, this is Maven Core behavior, not the plugin.
>
> On Fri, Apr 8, 2011 at 3:56 AM, Anders Hammar <an...@hammar.net> wrote:
>
>> I believe I've run into a similar issue at some time.
>> However, there are a few things you should understand:
>> 1. An reactor build is executed and for that to work, Maven *should* get
>> artifacts from the reactor and not the repo
>> 2. executing "mvn pmd:pmd" will not install any artifacts to the local
>> repository - the build lifecycle is *not* executed
>>
>> I think I basically gave up on this as I kind of think it's a hack reusing
>> the sources from a different project. And it wasn't really my
>> problem/project, so I told them to refactor instead. :-)
>> I think that the jira ticket I filed for this is MDEP-291.
>>
>> /Anders
>>
>>
>> On Fri, Apr 8, 2011 at 09:28, Lucas Persson <lu...@oracle.com>wrote:
>>
>>> Hi
>>>
>>>
>>> I have some issues with the maven-dependency-plugin vers 2.2 under
>>> Maven3.
>>>
>>> In one project I uses the plugin to unpack a sources artifact like this:
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-dependency-plugin</artifactId>
>>> <executions>
>>> <execution>
>>> <id>unpack-artifact-sources</id>
>>> <phase>generate-resources</phase>
>>> <goals>
>>> <goal>unpack</goal>
>>> </goals>
>>> <configuration>
>>> <artifactItems>
>>> <artifactItem>
>>> <groupId>oracle.ucs.callcontrol</groupId>
>>> <artifactId>callcontrolapi</artifactId>
>>> <version>${project.version}</version>
>>> <classifier>sources</classifier>
>>> <overWrite>true</overWrite>
>>> </artifactItem>
>>> </artifactItems>
>>>
>>> <outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
>>> </configuration>
>>> </execution>
>>> </executions>
>>> </plugin>
>>>
>>>
>>> This works very well when doing e.g. 'mvn install'
>>> But when runnning e.g. mvn pmd:pmd on the parent project (which also
>>> builds the artifact that this project tries to unpack)
>>> then the maven-dependency-plugin uses that project's target dir instead
>>> taking the sources jar form the repository.
>>>
>>> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/target/unpack-sources
>>>
>>>
>>> This is very strange.
>>>
>>> Anyone with similar experience?
>>>
>>> Thanks
>>> Lucas
>>>
>>>
>>> --
>>> [image: Oracle] <http://www.oracle.com>
>>> Lucas Persson | Principal Member of Technical Staff
>>> Phone: +4684773644 | | | Mobile: +46730946656
>>> Oracle Communications Platform
>>> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>>>
>>> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
>>> [image: Green Oracle] <http://www.oracle.com/commitment> Oracle is
>>> committed to developing practices and products that help protect the
>>> environment
>>>
>>
>>
>
--
Oracle <http://www.oracle.com>
Lucas Persson | Principal Member of Technical Staff
Phone: +4684773644 <tel:+4684773644> | | | Mobile: +46730946656
<tel:+46730946656>
Oracle Communications Platform
ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
Re: maven-dependency-plugin uses target dir instead of artifacts from repository
Posted by Brian Fox <br...@infinity.nu>.
It's not a hack, the plugin asks maven core to resolve the artifacts and the
objects it gets back have file handles. In reactor builds with sibling
dependencies, those handles point to the sibling target folder. If you do a
compile reactor build, those handles will point to the /target/classes
folder. IOW, this is Maven Core behavior, not the plugin.
On Fri, Apr 8, 2011 at 3:56 AM, Anders Hammar <an...@hammar.net> wrote:
> I believe I've run into a similar issue at some time.
> However, there are a few things you should understand:
> 1. An reactor build is executed and for that to work, Maven *should* get
> artifacts from the reactor and not the repo
> 2. executing "mvn pmd:pmd" will not install any artifacts to the local
> repository - the build lifecycle is *not* executed
>
> I think I basically gave up on this as I kind of think it's a hack reusing
> the sources from a different project. And it wasn't really my
> problem/project, so I told them to refactor instead. :-)
> I think that the jira ticket I filed for this is MDEP-291.
>
> /Anders
>
>
> On Fri, Apr 8, 2011 at 09:28, Lucas Persson <lu...@oracle.com>wrote:
>
>> Hi
>>
>>
>> I have some issues with the maven-dependency-plugin vers 2.2 under
>> Maven3.
>>
>> In one project I uses the plugin to unpack a sources artifact like this:
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-dependency-plugin</artifactId>
>> <executions>
>> <execution>
>> <id>unpack-artifact-sources</id>
>> <phase>generate-resources</phase>
>> <goals>
>> <goal>unpack</goal>
>> </goals>
>> <configuration>
>> <artifactItems>
>> <artifactItem>
>> <groupId>oracle.ucs.callcontrol</groupId>
>> <artifactId>callcontrolapi</artifactId>
>> <version>${project.version}</version>
>> <classifier>sources</classifier>
>> <overWrite>true</overWrite>
>> </artifactItem>
>> </artifactItems>
>>
>> <outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>>
>> This works very well when doing e.g. 'mvn install'
>> But when runnning e.g. mvn pmd:pmd on the parent project (which also
>> builds the artifact that this project tries to unpack)
>> then the maven-dependency-plugin uses that project's target dir instead
>> taking the sources jar form the repository.
>>
>> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/target/unpack-sources
>>
>>
>> This is very strange.
>>
>> Anyone with similar experience?
>>
>> Thanks
>> Lucas
>>
>>
>> --
>> [image: Oracle] <http://www.oracle.com>
>> Lucas Persson | Principal Member of Technical Staff
>> Phone: +4684773644 | | | Mobile: +46730946656
>> Oracle Communications Platform
>> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>>
>> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
>> [image: Green Oracle] <http://www.oracle.com/commitment> Oracle is
>> committed to developing practices and products that help protect the
>> environment
>>
>
>
Re: maven-dependency-plugin uses target dir instead of artifacts from repository
Posted by Anders Hammar <an...@hammar.net>.
I believe I've run into a similar issue at some time.
However, there are a few things you should understand:
1. An reactor build is executed and for that to work, Maven *should* get
artifacts from the reactor and not the repo
2. executing "mvn pmd:pmd" will not install any artifacts to the local
repository - the build lifecycle is *not* executed
I think I basically gave up on this as I kind of think it's a hack reusing
the sources from a different project. And it wasn't really my
problem/project, so I told them to refactor instead. :-)
I think that the jira ticket I filed for this is MDEP-291.
/Anders
On Fri, Apr 8, 2011 at 09:28, Lucas Persson <lu...@oracle.com>wrote:
> Hi
>
>
> I have some issues with the maven-dependency-plugin vers 2.2 under Maven3.
>
> In one project I uses the plugin to unpack a sources artifact like this:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>unpack-artifact-sources</id>
> <phase>generate-resources</phase>
> <goals>
> <goal>unpack</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>oracle.ucs.callcontrol</groupId>
> <artifactId>callcontrolapi</artifactId>
> <version>${project.version}</version>
> <classifier>sources</classifier>
> <overWrite>true</overWrite>
> </artifactItem>
> </artifactItems>
>
> <outputDirectory>${project.build.directory}/unpack-sources</outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
>
> This works very well when doing e.g. 'mvn install'
> But when runnning e.g. mvn pmd:pmd on the parent project (which also builds
> the artifact that this project tries to unpack)
> then the maven-dependency-plugin uses that project's target dir instead
> taking the sources jar form the repository.
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (unpack-artifact-sources) on project javadoc: Error unpacking file: /ade/aime_sdp_924164/target/oracle.ucs.callcontrol/callcontrolapi/target/classes to: /ade/aime_sdp_924164/target/oracle.sdp.tools/javadoc/target/unpack-sources
>
>
> This is very strange.
>
> Anyone with similar experience?
>
> Thanks
> Lucas
>
>
> --
> [image: Oracle] <http://www.oracle.com>
> Lucas Persson | Principal Member of Technical Staff
> Phone: +4684773644 | | | Mobile: +46730946656
> Oracle Communications Platform
> ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm
>
> Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
> [image: Green Oracle] <http://www.oracle.com/commitment> Oracle is
> committed to developing practices and products that help protect the
> environment
>