mvn:install to place my jar in nexus remote repository

扶醉桌前 提交于 2019-12-20 11:56:13

问题


I am using maven in eclipse (m2 eclipse)

When i execute mvn:install i want my jar(artifact) to be installed in the nexus repository which is located on the server(right now the installed jar is placed in the local system repository).. how can i do that ?

I even changed this to my local repository address


回答1:


Typically, you'd use mvn deploy to deploy to a non-local repository.

You will, of course, need to have the repo configured, either in your maven settings.xml or in the project POM.

As we always use the same internal repo, I've done this in the Maven settings.xml, more precisely, the "profiles" section.

Here is my config for reference:

  <profiles>
    <profile>
      <id>artifactory</id>
      <repositories>
        <repository>
          <id>central</id>
          <name>libs-releases</name>
          <url>http://repo.example.com/libs-releases</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>snapshots</id>
          <name>libs-snapshots</name>
          <url>http://repo.example.com/libs-snapshots</url>
          <snapshots />
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <name>plugins-releases</name>
          <url>http://repo.example.com/plugins-releases</url>
          <snapshots><enabled>false</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>


来源:https://stackoverflow.com/questions/5117000/mvninstall-to-place-my-jar-in-nexus-remote-repository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!