2014-02-18 106 views
4

我想在我的项目中使用maven-release-plugin。我有一个名为Artifactory的Maven仓库。我可以用MVN发布:准备和MVN发布:表现良好,但我不明白为什么神器部署到库快照本地和不库释放本地mvn发布:执行不部署发布版本

的settings.xml

<server> 
    <id>local-artifactory</id> 
    <username>user</username> 
    <password>password</password> 
</server> 
... 
<mirror> 
    <id>local-artifactory</id> 
    <mirrorOf>*</mirrorOf> 
    <url>http://localhost:8081/artifactory/repo</url> 
</mirror> 

本地行家父母

enter code here<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>examples</groupId> 
<artifactId>local-maven-parent</artifactId> 
<version>1</version> 
<packaging>pom</packaging> 

<repositories> 
    <repository> 
     <id>local-artifactory</id> 
     <name>Local Central Repository</name> 
     <url>http://localhost:8081/artifactory/repo</url> 
     <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
     </snapshots> 
    </repository> 
</repositories> 

<distributionManagement> 
    <repository> 
     <id>local-artifactory</id> 
     <name>Local Release Repository</name> 
     <url>http://localhost:8081/artifactory/libs-release-local</url> 
    </repository> 
    <snapshotRepository> 
     <id>local-artifactory</id> 
     <name>Local Snapshot Repository</name> 
     <url>http://localhost:8081/artifactory/libs-snapshot-local</url> 
    </snapshotRepository> 
</distributionManagement> 

POM-父

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<parent> 
    <groupId>examples</groupId> 
    <artifactId>local-maven-parent</artifactId> 
    <version>1</version> 
</parent> 

<scm> 
    <developerConnection>scm:git:[email protected]:demo.git</developerConnection> 
    <tag>HEAD</tag> 

<artifactId>pom-parent</artifactId> 
<version>1.0.11-SNAPSHOT</version> 
<packaging>pom</packaging> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.2.1</version> 
      <executions> 
       <execution> 
        <id>default</id> 
        <goals> 
         <goal>perform</goal> 
        </goals> 
        <configuration> 
         <pomFileName>../${project.artifactId}/pom.xml</pomFileName> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

我想POM父 - $ {版本}出现在库释放本地

+0

您是否尝试过给发行库不同的ID(不幸的是复制服务器设置该id以及)? – Wouter

+0

我做过,没有任何事情发生。我想,我必须配置maven-release-plugin配置部分,但我不知道如何。 – GaborSzabo7

+0

为什么需要使用不同的pomFileName来配置maven-release-plugin而不是使用默认值?目的是什么?除此之外,你得到的错误信息是什么?此外,如果您需要释放“pom-parent”,则需要释放“pom-parent”所在的项目,而不是它的子项。 – khmarbaise

回答

1

实际部署是通过maven-deploy-plugin完成的,所以我会尝试在那里配置它。

喜欢的东西:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-deploy-plugin</artifactId> 
    <version>2.8.1</version> 
    <configuration> 
     <altReleaseDeploymentRepository>local-artifactory::default::http://localhost:8081/artifactory/libs-release-local</altReleaseDeploymentRepository> 
    </configuration> 
    </plugin> 

结帐的插件的选项目标文档: https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

+0

它不起作用。我没有看到它想要部署发布。 – GaborSzabo7

相关问题