David, I just upgraded to 3.3.9, and ran the following on one of my projects (twice):
mvn clean package In both cases the JAR files were copied to my output directory and included in both the zip and tar.gz files. I guess a little more information is needed?? . . . just my two cents /mde/ On 3/10/2016 3:44 PM, David M. Karr wrote: > On 03/10/2016 03:36 PM, Mark Eggers wrote: >> David, >> >> If you're providing a list of dependencies, then yes you'll use the copy >> instead of copy-dependencies. >> >> See the following for that information: >> >> https://maven.apache.org/plugins/maven-dependency-plugin/index.html >> >> Also, I notice that you don't have outputDirectory specified. If you >> don't, the dependencies will be copied to >> ${project.build.directory}/dependency. > > Actually, I was specifying that individually on each artifactItem, but > it's definitely an improvement to only specify that once. In any case, > it still makes no difference. It's not writing the artifacts, whether I > use "copy" or "copy-dependencies", or whether I say to write them to > "libs" or "${project.build.directory}/libs". It ("copy", to be specific) > did it the first time I ran this, but never since then. > > I'm using Maven 3.3.9, with JDK 1.8.0_60. > >> >> See the following for that information: >> >> https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html >> >> . . . just my two cents >> /mde/ >> >> On 3/10/2016 3:22 PM, David M. Karr wrote: >>> Thanks, but replacing my "manual" copy goal with "copy-dependencies" and >>> implicit dependency declarations made no difference. No error at this >>> phase, it just doesn't do anything. >>> >>> On 03/10/2016 02:57 PM, Mark Eggers wrote: >>>> 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/
signature.asc
Description: OpenPGP digital signature