![]()
I will show you in an Apache Maven configuration file how to copy files to server each time the package phase is executed.
This snippet of code is a ready to use code that make use of Apache Ant task scp, Just put this snippet of code in your Maven module where the assembly is executed or anywhere else to push all tar.gz files to a server just run a maven mvn package, you can add as many ant task and push to many server the same file during the reactor build.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>server-copy</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<echo message="Push to server/home/"/>
<scp trust="yes"
todir="user:password@server:/home/">
<fileset dir="${basedir}/target">
<include name="**/*.tar.gz"/>
</fileset>
</scp>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
</plugin>
The maven-deploy-plugin allows you to configure the deploy phase to deploy to a server using scp. There is a page in the documentation that describes how it can be done.
Another alternative would be to use Maven Wagon SCP like described in this post for example
![]()
In this small post, I’ll show you how to remove duplicated resources in the Open Resource view of Eclipse
Eclipse – M2Eclipse – Subversive
Read more: Apache M2Eclipse: Get rid of Duplicate resources when opening resources and types
![]()
Thanks to Packt Publishing for having sent me this book to review. I will publish a review in the next coming days
You may also consider reading all my articles related to Apache Maven
First a big thanks to Packt Publishing for having sent me this book to review! I did enjoy going through this book, while I did not learn a lot of new stuff (I am using Apache Maven daily since 2006!), I found it to be concise and would recommend it anytime to any of my colleagues. But let’s go through my review of this cookbook of over 50 recipes towards optimal Java Software Engineering with Maven 3:

Apache Maven 3 Cookbook is a clear, precise, well-written book that gives readers clear recipes for the release process using Apache Maven 3. The authors give a step-by-step account of expectations and hurdles for software development.
The first few chapters quickly bring you to the point to be comfortable using Maven on straightforward projects, and the later chapters provide even more recipes examples on subjects like running a Repository Manager, Writing Plugins, and details on various techniques. The book also covers numerous real world software delivery issues such as multi-module projects, web/enterprise projects, dependency management, automatic testing and documentation.
To sum up key points from this 224 pages book in a few bullets:
The author Srirangan go into detail in describing each of these themes.
if you want to be able to deliver your software to any target environment, using continuous delivery processes, chances are high that Apache Maven is the right tool for this job, and this book should be part of your technical library, beside also of course the free online book of Sonatype Maven: The Complete Reference
The Maven Dependency Plugin among other things include a dependency:analyze-duplicate
The dependency plugin provides the capability to manipulate artifacts. It can copy and/or unpack artifacts from local or remote repositories to a specified location.
This Apache Maven plugin is really feature rich and provide a lot of interesting goals:
Read more: List conflicting dependencies in the Maven reactor
Privacy Statement | Copyright Notice | Licenses
© 1999-2012 Waltercedric.com. Designed by Cédric Walter. Sitemap
Reproduction without explicit permission is prohibited. All Rights Reserved.
Disclaimer: The editor(s) reserve the right to edit any comments that are found to be abusive, offensive, contain profanity, serves as spam, is largely self-promotional, or displaying attempts to harbour irrelevant text links for any purpose.