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部署:文件步骤:自动部署到快照或发布存储库_Maven_Maven Deploy Plugin - Fatal编程技术网

Maven部署:文件步骤:自动部署到快照或发布存储库

Maven部署:文件步骤:自动部署到快照或发布存储库,maven,maven-deploy-plugin,Maven,Maven Deploy Plugin,我的pom.xml中有以下部分 <repositories> <repository> <id>maven-booking-snapshots</id> <url>https://artifactory.booking.com/maven-booking-snapshots</url> </repository> <repository> <id>maven-booking

我的
pom.xml中有以下部分

  <repositories>
<repository>
  <id>maven-booking-snapshots</id>
  <url>https://artifactory.booking.com/maven-booking-snapshots</url>
</repository>
<repository>
  <id>maven-booking-releases</id>
  <url>https://artifactory.booking.com/maven-booking-releases</url>
</repository>

maven预订快照
https://artifactory.booking.com/maven-booking-snapshots
maven预订发布
https://artifactory.booking.com/maven-booking-releases


maven快照
快照存储库
https://artifactory.com/maven-snapshots
maven发布
发布存储库
https://artifactory.com/maven-releases


org.apache.maven.plugins
maven阴影插件
3.1.1
包裹
阴凉处
谷歌
谷歌
伊奥·内蒂
艾奥内蒂
假的
maven部署插件
2.8.2
部署节点
部署文件
部署
${basedir}/target/original-${project.artifactId}-${project.version}.jar
${project.groupId}
${project.artifactId}
${project.version}
点头
${project.distributionManagement.repository.url}
${project.distributionManagement.repository.id}

当我运行
mvn deploy:file
时,文件将始终上载到发行版存储库中,(我认为)问题在于插件的
标记指向
project.distributionManagement.repository.url
。同时,我不能指出
项目.distributionManagement.snapshotRepository
,因为我希望部署目标取决于pom的版本。如何在部署插件的运行中实现这样的灵活性?

无需单独配置maven部署插件,只需使用
mvn clean deploy
此外,pom中关于存储库的配置应该使用settings.xml文件来完成。否则,您需要在每个项目中执行此操作…我想使用
deploy:file
上载一些特定的附加文件没有意义。你在说什么样的附加文件?我想部署2个JAR。我在这里使用的不是默认的工件,而是一个附加的工件one@khmarbaise这个问题有道理。有一个名为
maven deploy plugin
的插件,这意味着它可以用来添加额外的文件或自定义上传阶段。
<distributionManagement>
  <snapshotRepository>
      <id>maven-snapshots</id>
      <name>Snapshot Repository</name>
      <url>https://artifactory.com/maven-snapshots</url>
  </snapshotRepository>
  <repository>
      <id>maven-releases</id>
      <name>Release Repository</name>
      <url>https://artifactory.com/maven-releases</url>
  </repository>
</distributionManagement>
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.1.1</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <relocations>
            <relocation>
              <pattern>com.google</pattern>
              <shadedPattern>com.shaded.google</shadedPattern>
            </relocation>
            <relocation>
              <pattern>io.netty</pattern>
              <shadedPattern>hidden.io.netty</shadedPattern>
            </relocation>
          </relocations>
          <shadedArtifactAttached>false</shadedArtifactAttached>
        </configuration>
      </execution>
    </executions>
  </plugin>     

<plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.8.2</version>
    <executions>
    <execution>
      <id>deploy-nodeps</id>
        <goals>
          <goal>deploy-file</goal>
        </goals>
        <phase>deploy</phase>
        <configuration>
          <file>${basedir}/target/original-${project.artifactId}-${project.version}.jar</file>
          <groupId>${project.groupId}</groupId>
          <artifactId>${project.artifactId}</artifactId>
          <version>${project.version}</version>
          <classifier>nodeps</classifier>
          <url>${project.distributionManagement.repository.url}</url>
          <repositoryId>${project.distributionManagement.repository.id}</repositoryId>
        </configuration>
      </execution>
    </executions>
  </plugin>