views:

685

answers:

2

Hello, could someone provide working example (full maven plugin configuration) how to copy built jar file to a specific server(s) at the time of deploy phase?

I have tried to look at wagon plugin, but it is hugely undocumented and I was not able to set it up. The build produces standard jar that is being deployed to Nexus, but I need to put the jar also to the test server automatically over local network (\someserver\testapp\bin).

I will be grateful for any hints.

Thank you

+1  A: 

I don't have a working example but the "Maven Assembly Plugin" should do the job. You can configure it to run automatically in the deploy phase.
When you write your own assembly descriptor you can specify a path where the assembly should be written to. I think maven shouldn't care about wether it's a local or remote path.

Roland Schneider
+3  A: 

Actually I have found a different way: Dependency plugin!

<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>

It also takes windows path like \resource.

Petr Macek