如何在maven部署阶段将构建的工件复制到远程Windows服务器上的目录中?

Pet*_*cek 3 java maven-2 build automated-deploy

有人可以提供工作示例(完整的maven插件配置)如何在部署阶段将构建的jar文件复制到特定的服务器?

我试图看看wagon插件,但是它没有大量记录,我无法设置它.构建产生了部署到Nexus的标准jar,但我需要通过本地网络(\ someserver\testapp\bin)将jar也自动放到测试服务器上.

任何提示我都会感激不尽.

谢谢

Pet*_*cek 9

实际上我找到了一种不同的方式:依赖插件!

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>copy-to-ebs</id>
      <phase>deploy</phase>
      <goals>
          <goal>copy</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>${project.groupId}</groupId>
            <artifactId>${project.artifactId}</artifactId>
            <version>${project.version}</version>
            <type>${project.packaging}</type>
          </artifactItem>
        </artifactItems>
        <outputDirectory>\\someserver\somedirectory</outputDirectory>
        <stripVersion>true</stripVersion>                    
      </configuration>
    </execution>                        
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

它还需要像\\ resource这样的Windows路径.

请注意,\\ someserver\somedirectory仅适用于Windows客户端.

  • 在这种情况下如何设置凭据? (2认同)