I'd like to place my output jar and jar-with-dependencies into another folder (not in target/
but in ../libs/
).
How can I do that?
By default, you can find it here: Windows: C:\Users\USERNAME\. m2\repository.
You can use the outputDirectory parameter of the maven-jar-plugin for this purpose:
<project> ... <build> <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <outputDirectory>../libs</outputDirectory> </configuration> </plugin> ... </plugins> </build> ... </project>
But as cdegroot wrote, you should probably better not fight the maven way.
If you want to copy the artifact into a directory outside your project, solutions might be:
maven-jar-plugin
and configure outputDirectory
maven-antrun-plugin
and copy taskcopy-maven-plugin
by Evgeny GoldinExample for the copy-maven-plugin
is:
<plugin> <groupId>com.github.goldin</groupId> <artifactId>copy-maven-plugin</artifactId> <version>0.2.5</version> <executions> <execution> <id>deploy-to-local-directory</id> <phase>install</phase> <goals> <goal>copy</goal> </goals> <configuration> <skipIdentical>false</skipIdentical> <failIfNotFound>false</failIfNotFound> <resources> <resource> <description>Copy artifact to another directory</description> <targetPath>/your/local/path</targetPath> <directory>${project.build.directory}</directory> <includes> <include>*.jar</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With