2015-06-11 111 views
1

我有一个webjars项目,我想构建快照并将它们部署在本地(位于我们的基础结构中),但版本由webjars.org管理。将nexus-staging-maven插件重定向到内部存储库

https://github.com/webjars/oscar/blob/15.0.0-RC1/pom.xml

我现在面临的问题是,他们需要定义其释放过程中承上启下分期,Maven的插件。因此,我希望尽可能为POM量身定制POM,并尽可能通过命令行(或最坏情况,简档)制作自己的偏差。

通常情况下,如果从头开始这样做,您可能会在配置文件中引入暂存插件,但我不认为我有这个选项。 (我可能必须进行修改,并与他们讨论。)

我从来没有使用过staging插件,所以这是我的第一次曝光,它不是一个愉快的给定我试图去做。我觉得我正在与系统作斗争。

我原本以为通过指定的东西:

-DsonatypeOssDistMgmtSnapshotsUrl=http://myurl 

和推动在正确的位置神器,但我无法弄清楚如何提供凭据。 (401未授权)我认为指定serverId可能会工作,但没有。

-DserverId=public-snapshots 

http://books.sonatype.com/nexus-book/reference/staging-deployment.html

我又试图创建一个配置文件,在那里我会做这样的事情:

<profile> 
    <id>disable-staging</id> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.sonatype.plugins</groupId> 
       <artifactId>nexus-staging-maven-plugin</artifactId> 
       <version>1.6.5</version> 
       <configuration combine.self="override"> 
        <executions> 
         <execution> 
          <id>injected-nexus-deploy</id> 
          <phase>none</phase> 
         </execution> 
        </executions> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</profile> 

但这并不能帮助。有效pom显示:

<plugin> 
    <groupId>org.sonatype.plugins</groupId> 
    <artifactId>nexus-staging-maven-plugin</artifactId> 
    <version>1.6.5</version> 
    <extensions>true</extensions> 
    <executions> 
    <execution> 
     <id>injected-nexus-deploy</id> 
     <phase>deploy</phase> 
     <goals> 
     <goal>deploy</goal> 
     </goals> 
     <configuration combine.self="override"> 
     <executions> 
      <execution> 
      <id>injected-nexus-deploy</id> 
      <phase>none</phase> 
      </execution> 
     </executions> 
     </configuration> 
    </execution> 
    </executions> 
    <configuration combine.self="override"> 
    <executions> 
     <execution> 
     <id>injected-nexus-deploy</id> 
     <phase>none</phase> 
     </execution> 
    </executions> 
    </configuration> 
</plugin> 

我无法解除绑定部署阶段。

我想知道如果有人有什么想法在这种情况下做什么?

回答

1

您可以使用Nexus分期插件的财产skipNexusStagingDeployMojo来实现这一目标:

mvn clean package deploy:deploy -DskipNexusStagingDeployMojo=true 
-DaltDeploymentRepository=snapshots::default::https://my.nexus.host/content/repositories/snapshots-local 

明确调用package然后deploy:deploy,否则是很重要的(当时只有调用mvn deploy)的maven-的默认执行部署插件被Nexus Staging插件抑制(即使跳过设置为true)。

+0

工作就像一个魅力。非常感谢你。如果这能让我这样做,我会乐观的。 – tastle

+0

@tastle你能把它标记为正确答案吗? –