Generating JAR and POM file following the Maven repository layout?

I have a project where I need to generate the jar and pom files following the same method with the maven plugin maven-install-plugin generates in the local repository, as can be seen in the return of the IDE to build the project:

--- maven-install-plugin:2.3.1:install (default-install) @ projeto-java ---
Installing C:\Users\matheus\Java\Projeto-Java\target\Projeto-java-1.2.3.jar to C:\Users\matheus\.m2\repository\br\com\xxx\java\projeto-java\1.2.3\projeto-java-1.2.3.jar
Installing C:\Users\matheus\Java\Projeto-Java\pom.xml to C:\Users\matheus\.m2\repository\br\com\xxx\java\projeto-java\1.2.3\projeto-java-1.2.3.pom

I need the files project-java-1.2.3.pom and project-java-1.2.3.jar are placed in specific directory, how can I change the directory where the plugin places or have another plugin to do that?

Upvotes: 1

Views: 131

Answers (1)

RITZ XAVI
RITZ XAVI

Reputation: 3799

You can change the location of your local maven repository (which is .m2 by default) by editing settings.xml file in your maven installation folder.

You can find your settings.xml file in {M2_HOME}\conf\setting.xml.
To change the default local maven repository location, add the below code within the <settings> tag :

<localRepository>D:/location-where-you-want</localRepository>

Note that, this will now start sending all the artifacts (jars, wars, ears, poms, zip, etc) to the location your provided, not just one specific jar.

Upvotes: 2

Related Questions