how to deploy my artifact on to my nexus?

2019-02-08 02:26发布

I am using nexus open source as my repository manager for Maven 3.0.3

Maven is able to create artifact *.jar.

Now, I would like to know how I can push the generated artifact *.jar to the nexus repo manager, so that other dependent modules can pull from it.

I referred to this guide.

In settings.xml, I have

    <server>     
            <id>nexus-site</id>
            <username>admin</username>
            <password>xxxx</password>
    </server>

It fails.

How can invoke my deployment from mvn command or how to deploy my artifact on to my nexus?

4条回答
你好瞎i
2楼-- · 2019-02-08 03:00

Repository element should also be specified. Snippet:pom.xml

<distributionManagement>
    <repository>
      <id>internal.repo</id>
      <name>MyCo Internal Repository</name>
      <url>http://Nexus url</url>
    </repository>
  </distributionManagement>
查看更多
唯我独甜
3楼-- · 2019-02-08 03:03

There are two ways to do so.

The first is do it via Nexus web interface, just upload the artifact with necessary project information (groupId, artifactId, version)

The other is using mvn deploy. You need to set distributionManagement for repository to upload to, and user to authenticate as.

The second approach is strongly recommended if you are going it do deployment regularly. It is automated, and you can leverage on other Maven commands like mvn release

查看更多
冷血范
4楼-- · 2019-02-08 03:17

And if you want to add it to the snapshot repository, you need the following configuration inside your pom.xml

<distributionManagement>
    <repository>
         <id>internal.repo</id>
         <name>MyCo Internal Repository</name>
         <url>http://Nexus url</url>
    </repository>
    <snapshotRepository>
         <id>Snapshot.repo</id>
         <name>Your Snapshot Repository</name>
         <url>http://Nexus url</url>
    </snapshotRepository>
</distributionManagement>
查看更多
smile是对你的礼貌
5楼-- · 2019-02-08 03:22

Just try

   mvn deploy

that will deploy your artifact to the nexus repo manager.

Have you configured the distributionManagement section ?

查看更多
登录 后发表回答