0

My pom file's packaging is pom.

I would like to upload generated jar and pom files to repository like below.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <phase>package</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>
                    <configuration>
                        <file>target/${artifactId}-${version}.jar</file>
                        <repositoryId>SERVER-Snapshots</repositoryId>
                        <url>https://test.nexsus.com/content/repositories/snapshots/</url>
                    </configuration>
                </execution>
            </executions>
        </plugin>

I get the following error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project xxx: The artifact information is inco
mplete or not valid:
[ERROR] [0]  'groupId' is missing.
[ERROR] [1]  'artifactId' is missing.
[ERROR] [2]  'version' is missing.
[ERROR] -> [Help 1]

Also jar packaging pom deploy files such as jar, sha1, md5, pom and zip. How can I exclude some of them?

Web Devie
  • 1,207
  • 1
  • 13
  • 30
tompal18
  • 1,164
  • 2
  • 21
  • 39

4 Answers4

2

You can't use deploy:deploy-file from a pom. To deploy additional files, use the build helper to attach them to the current project as additional artifacts.

bmargulies
  • 97,814
  • 39
  • 186
  • 310
  • That would be a solution. Instead I created child pom(jar packaging) to deploy the jar. Still, a way of exclusion of the files in deploying is not known. – tompal18 Jul 31 '13 at 10:46
1

If all you want to do is to upload your artifact to your local repository manager all you have to do is to configure it in your POM as follows:

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Releases</name>
        <url>https://test.nexsus.com/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Snapshots</name>
        <url>https://test.nexsus.com/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

and then execute mvn deploy.

Nicola Musatti
  • 17,834
  • 2
  • 46
  • 55
0

Also jar packaging pom deploy files such as jar, sha1, md5, pom and zip. How can I exclude some of them?

Find out what generates the unwanted artifacts and stop if from generating them. By default a jar module should produce jar, pom, md5 and sha1 files. Something else is producing that zip (maybe Maven Assembly Plugin?), so disable that "something else" if you don't want it.

AFAIK, there is no way to configure deploy:deploy to not deploy some artifacts from a module. It's only possible to use the skip parameter to deploy nothing from that module.

Esko Luontola
  • 73,184
  • 17
  • 117
  • 128
0

The deploy plugin needs GAV information for the deployed file. It can extract them from your current pom if you add the following configuration:

<pomFile>pom.xml</pomFile>

kabado
  • 343
  • 5
  • 9