首页 文章

如何将maven插件上传到Nexus存储库?

提问于
浏览
7

我想将我的自定义maven插件上传到nexus存储库 .

我的问题是,当我通过web IU将我的插件上传到nexus时,普通依赖,maven无法找到它:

插件com.huawei:maven-project-version-plugin:1.0或其中一个依赖项无法解析:无法读取com.huawei的工件描述符:maven-project-version-plugin:jar:1.0:找不到com.mycompany:maven-project-version-plugin:pom:1.0 in http:// localhost:8081 / nexus / content / groups / public被缓存在本地存储库中,在nexus的更新间隔到来之前,不会重新尝试解析强制过去或更新 - > [帮助1]

但是当我通过命令行将我的插件安装到maven local repositiry(而不是nexus)时,一切都很好 .

那么,安装自定义maven插件和安装“非插件”文物之间的区别是什么?有什么窍门吗?

我的settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

2 回答

  • 8

    问题解决了 . 好吧,我不知道怎么做,但今天一切都很好 . 我认为问题出在Nexus缓存中 . 我刚删除了我的托管存储库并再次创建它 . 也许,有较少的激进方法,但我不知道它们=)删除工件然后只是“expire cache”在我的情况下没有帮助 .

    好吧,我的问题的答案:Nexus中的安装插件和非插件工件之间没有任何不同,除了一个 . 如果选择GAV定义:GAV参数,则必须在组合框“包装”中选择“maven-plugin” .

    我认为没有必要一步一步地写指令,这很简单 . 只需选择托管存储库 - >工件上载选项卡并填写必填字段 .

  • 4

    另外,您还必须上传Maven插件的pom . 如果你没有,Nexus会自动生成一个不正确的 . 即它只是一个由版本,artifactID,包装和groupID组成的基本pom .

相关问题