Deploy specific jars with the maven deploy plugin

965 Views Asked by At

I have 3 jars:

  • service.jar
  • service-exec.jar
  • service-tests.jar

I only want to deploy service.jar and service-tests.jar, this works fine with:

mvn --settings settings.xml -Drevision=1.0-SNAPSHOT generate-sources install
mvn --settings settings.xml -Drevision=1.0-SNAPSHOT -Dfile=target/service-1.0-SNAPSHOT.jar -Dfiles=target/service-1.0-SNAPSHOT-tests.jar -DgroupId=de.mycomp -DartifactId=service -Dversion=1.0-SNAPSHOT -Durl=https://nexus/ -DrepositoryId=nexus.de -Dclassifiers=tests -Dtypes=test-jar deploy:deploy-file

But when I use:

<plugin>
                            <artifactId>maven-deploy-plugin</artifactId>
                            <version>2.8.2</version>
                            <executions>
                                <execution>
                                    <id>default-deploy</id>
                                    <phase>none</phase>
                                </execution>
                                <execution>
                                    <id>files-deploy</id>
                                    <phase>deploy</phase>
                                    <goals>
                                        <goal>deploy-file</goal>
                                    </goals>
                                    <configuration>
                                        <repositoryId>nexus.de</repositoryId>
                                        <url>https://nexus/</url>
                                        <file>target/service-1.0-SNAPSHOT.jar</file>
                                        <files>target/service-1.0-SNAPSHOT-tests.jar</files>
                                        <classifiers>tests</classifiers>
                                        <types>test-jar</types>
                                        <groupId>de.mycomp</groupId>
                                        <artifactId>service</artifactId>
                                        <version>1.0-SNAPSHOT</version>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>

And then use

mvn --settings settings.xml -Drevision=1.0-SNAPSHOT generate-sources deploy

It deploys all 3 jars and then in addition the service-test.jar again.

Why does the plugin with this config still deploys all 3 + 1 jars? Shouldn't it be the same then the command??

0

There are 0 best solutions below