maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com.INVALID>
Subject Re: Why isn't maven-dependency-plugin copying my artifacts anymore?
Date Thu, 10 Mar 2016 22:57:52 GMT
David,

On 3/10/2016 2: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.
> 
> 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>
> -------------------

My copy looks like this:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-dependency-plugin</artifactId>
 <version>2.10</version>
 <executions>
  <execution>
   <phase>prepare-package</phase>
   <goals>
    <goal>copy-dependencies</goal>
   </goals>
   <configuration>
    <outputDirectory>${project.build.directory}/lib</outputDirectory>
    <includeScope>compile</includeScope>
   </configuration>
  </execution>
 </executions>
</plugin>

I'm currently running 3.3.3 and JDK 1.8.0_74. I need to upgrade my Maven.

This works as expected, with dependencies getting copied to target/lib.

I have this in my JAR plugin:

<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>

along with specifying the main class.

I create both a zip and a tar.gz file with the assembly plugin.

An end user just unpacks the archive, changes to the directory where the
archive was unpacked, and runs java -jar ${artifactId}.jar.

Seems to work reasonably well.

. . . just my two cents
/mde/
I use the assembly plugin to create a zip and a tar.gz file.


Mime
View raw message