Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 使用gradle将features.xml部署到nexus?_Maven_Deployment_Gradle_Nexus - Fatal编程技术网

Maven 使用gradle将features.xml部署到nexus?

Maven 使用gradle将features.xml部署到nexus?,maven,deployment,gradle,nexus,Maven,Deployment,Gradle,Nexus,我正在尝试创建一个gradle构建文件,以便将features.xml文件部署到本地nexus maven repo中。除了直接使用maven之外,我还没有找到任何关于如何做到这一点的例子。有没有人能举个例子来说明如何使用gradle?我附加的工作maven POM以及 谢谢, --基督教徒 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-

我正在尝试创建一个gradle构建文件,以便将features.xml文件部署到本地nexus maven repo中。除了直接使用maven之外,我还没有找到任何关于如何做到这一点的例子。有没有人能举个例子来说明如何使用gradle?我附加的工作maven 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/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>

4.0.0
公司部
部署功能
聚甲醛
1
feature.xml
nexus.repo
http://nexus:80/nexus/content/repositories/releases/
maven资源插件
2.4.3
复制资源
验证
复制资源
${basedir}/目标
资源
真的
org.codehaus.mojo
构建助手maven插件
附加工件
包裹
附加工件
target/features.xml
xml
特征

在gradle.properties中设置位置

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

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>

奏鸣曲
局部型联结
http://localServer/nexus/content/groups/public
*, !快照!释放

这最后一点将您的maven镜像与您的可发布工件区分开来

在与maven的关系中,在Nexus部署一个补充工件时,什么不起作用?