How to generate JAR and POM project by following the Maven repository layout?

Asked

Viewed 241 times

2

I have a project where I need to generate the jar and pom following the same method as the plugin Maven-install-plugin generates within the local repository, as in the return that is given when building 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 java-1.2.3.pom project and project-java-1.2.3.jar are placed in specific directory, how can I change the directory where the plugin puts or has another plugin that does this?

1 answer

0


It can be done by setting a profile and its directory within the pom.xml:

<profiles>
    <profile>
        <id>novoProfile</id>
        <build>
            <directory>${project.basedir}/diretorioDesejado</directory>
        </build>
    </profile>
</profiles>

And running the command using the new profile:

mvn install -PnovoProfile

Source

Browser other questions tagged

You are not signed in. Login or sign up in order to post.