2012-11-29 5 views
2

features.xml 파일을 로컬 넥서스 메이븐 레포에 배포하기 위해 gradle 빌드 파일을 만들려고합니다. maven을 직접 사용하는 것을 제외하고는이 작업을 수행하는 방법에 대한 예제를 찾을 수 없었습니다. 누구든지 gradle로 이것을 수행하는 방법에 대한 예제가 있습니까? 나는 일하는 maven POM을 붙이고있다.gradles를 사용하여 features.xml을 nexus에 배포 하시겠습니까?

감사합니다, --Christian

<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/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<groupId>company.dept</groupId> 
<artifactId>deploy-feature</artifactId> 
<packaging>pom</packaging> 
<version>1.0</version> 
<name>feature.xml</name> 
<distributionManagement> 
    <repository> 
     <id>nexus.repo</id> 
     <url>http://nexus:80/nexus/content/repositories/releases/</url> 
    </repository> 
</distributionManagement> 

<build> 
    <plugins> 
     <plugin> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.4.3</version> 
      <executions> 
       <execution> 
        <id>copy-resources</id> 
        <phase>validate</phase> 
        <goals> 
         <goal>copy-resources</goal> 
        </goals> 
        <configuration> 
         <outputDirectory>${basedir}/target</outputDirectory> 
         <resources> 
          <resource> 
           <directory>resources</directory> 
           <filtering>true</filtering> 
          </resource> 
         </resources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>build-helper-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>attach-artifacts</id> 
        <phase>package</phase> 
        <goals> 
         <goal>attach-artifact</goal> 
        </goals> 
        <configuration> 
         <artifacts> 
          <artifact> 
           <file>target/features.xml</file> 
           <type>xml</type> 
           <classifier>features</classifier> 
          </artifact> 
         </artifacts> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

+0

로부터 받는다는 미러를 분리? – khmarbaise

답변

1

설정 build.gradle에서 gradle.properties

mavenServer=http://localServer:8042 
mavenRepo=/nexus/content/groups/public 
mavenReleases=/nexus/content/repositories/releases/ 
repoUsername=admin 
repoPassword=password 

의 위치에

apply plugin: 'maven' 

repositories { 
    maven { 
    url = mavenServer+mavenRepo 
    } 
} 

artifacts { 
    archives file('yourxmlfile') 
} 

uploadArchives { 
    repositories { 
    mavenDeployer { 

     pom.artifactId = 'yourID' 

     repository(url: mavenServer+mvnReleases) { 
     authentication(username:repoUsername, password:repoPassword) 
     } 
    } 
    } 
} 

당신의 당신의 /.m2/ 디렉토리 내부 Settings.XML이는

<settings xsd="<apache maven xsd>"> 
<mirrors> 
    <mirror> 
    <id>sonatype</id> 
    <name>local sonatype nexus</name> 
    <url>http://localServer/nexus/content/groups/public</url> 
    <mirrorOf>*, !snapshots, !releases</mirrorOf> 
    </mirror> 
</mirrors> 
</settings> 

이 마지막 비트는 넥서스에 추가 유물을 배포 할 메이븐과의 관계에서 작동하지 않습니다 무엇 당신의 해제 유물

관련 문제