maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Karr" <davidmichaelk...@gmail.com>
Subject Re: Why isn't maven-dependency-plugin copying my artifacts anymore?
Date Fri, 11 Mar 2016 17:38:30 GMT
On 03/10/2016 02:31 PM, David M. Karr wrote:
> Several days ago, on the advice of someone on another list, I 
> configured the use of the "maven-dependency-plugin" in my POM so that 
> the build would copy some dependencies into a local folder, not inside 
> the target folder.
>
> This worked the very first time I ran the build with it, and I've been 
> using the results for a while.
>
> Today I started to look at this again, to ensure that these copied 
> artifacts would be properly cleaned up from "mvn clean".  I first 
> tried reconfiguring where it wrote the jars, changing it from "libs" 
> to "target/libs".  For some reason, when I ran the build, it didn't 
> create "target/libs", nor did it copy the jars.  At that point, I 
> thought there was some issue with writing them into a subfolder of 
> "target".
>
> I then changed it back to "libs", but I implemented additional 
> "maven-clean-plugin" configuration to make it delete that folder. When 
> I ran "mvn clean", it did what I expected, removing that folder, along 
> with "target".
>
> However, when I then tried to build the whole thing again, I found 
> that it wasn't creating the "libs" folder, and it wasn't copying the 
> jars there.  I then tried manually creating "libs", but that didn't 
> help.  I tried adding "--debug", which didn't tell me anything 
> useful.  I imagine the same thing that is making it not copy the jars 
> into "libs" is the same thing that prevented it writing them into 
> "target/libs", so there likely wasn't a real issue with using a 
> subfolder of "target", but something else is just preventing it from 
> copying the jars.

I had a "doh!" realization this morning, but I still need a little more 
information to implement the correct fix.

The reason this is working for all of you and not for me is that you're 
not compiling any source files, and my source files actually depend on 
those dependencies, and I wasn't mentioning to you that the build ends 
with compile errors because it can't find those dependencies, so it 
never gets to the "package" phase.

The problem is that I specified the copy to be done in the "package" 
phase, which is well after they need to be there.  I first tried 
changing this to "pre-compile", and then "prepare-resources", but 
neither of those seemed to make no difference.  I then tried "validate" 
for lack of a better idea, and that worked.  However, I'd prefer to use 
a "just in time" approach, so I would think a later phase would be more 
appropriate, but I'm not sure what that would be.  I'm wondering whether 
the Tycho compiler being in play puts some custom phases in scope here.  
I've posed the same question on the Tycho user list.
>
> This is what I have in the POM for this plugin (eliding the details of 
> each artifact):
> -----------------
>         <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
>             <version>2.10</version>
>             <executions>
>                 <execution>
>                     <id>copy</id>
>                     <phase>package</phase>
>                     <goals>
>                         <goal>copy</goal>
>                     </goals>
>                     <configuration>
>                         <artifactItems>
>                             <artifactItem>
>                             ...
>                             </artifactItem>
>                             <artifactItem>
>                             ...
>                             </artifactItem>
>                             <artifactItem>
>                             ...
>                             </artifactItem>
>                             <artifactItem>
>                             ...
>                             </artifactItem>
>                         </artifactItems>
>                     </configuration>
>                 </execution>
>             </executions>
>         </plugin>
> -------------------
>
> What might be wrong here?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message