Sunday, June 15, 2008

How to FTP artifacts in maven2

If there is one word a team should keep in mind when building a CI (Continuous Integration) environment it's Automate, Automate, and Automate (see Production-ready software, on-demand). Most teams, including mine currently, performs their releases manually; creating the branch, incrementing the POMs, uploading the artifacts to a repository, etc. This is one reason I wrote about using the maven release plugin to automate this process. I will say that having a CI server such as Hudson only helps in making automation easier.

My team also creates an official release about once every two months and supports that release anywhere between 1-2 weeks to months. It's also pretty intense during those 1-2 weeks when we have co-workers on-site installing and supporting our software in a completely different timezone and with limited access to the phone and internet.

Over the weekend I wrote a simple maven2 pom to help automate FTP'ing the release artifacts to an FTP server. Last week we created a branch and a job in hudson that builds that branch. After it successfully builds we use the assembly plugin to package our EAR, documentation, SQL files, and everything else into a single folder. In the past, a guy would then manually copy these files to the FTP server, which was used by the on-site team to download the latest artifacts containing improvements and bug fixes. This release we wanted to automate this step to increase our response time for the on-site team.

First Try using GMaven Plugin
I knew that Ant had an FTP task and I love doing Ant in Groovy because its so much easier so I decided to first try the GMaven plugin (maven groovy plugin). It was a short trip since the FTP task is an optional library in Ant and you have to include the jar in your POM, but I could never get the gmaven plugin to recognize the dependency (see MGROOVY-152). Look at the Jira issue attachments if you want to reference my POM as an example. It's too bad I couldn't get this to work because it would have been sweet:

log.info('Entering in ftp script')

def config = [server: 'localhost',
remotedir: '/home/jlorenzen/ftptest',
user: 'ftp',
password: 'ftp'
];

ant.ftp(config) {
fileset(dir: '
/home/jlorenzen/Documents')
}

Second Try Maven AntRun Plugin
I was finally able to get this to work using the maven-antrun-plugin. Here is my POM
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>ftp</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ftp server="localhost"
remotedir="/home/jlorenzen/ftptest"
userid="ftp"
password="ftp">
<fileset dir="/home/jlorenzen/Documents"/>
</ftp>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-commons-net</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

12 comments:

sdudzin said...

Hi,

Did you consider using maven site plugin to publish your documentation over ftp?

Siarhei

Unknown said...

great article, I was very impressed about it, wish you would have stayed next share
kids games
friv
unblockedgames
un show mas

Unknown said...

Thank you for that information you article
juegos.com
juegos de matar
jogos friv

Unknown said...

Its really good information, i like your blog post. Thanks for sharing
Signature:
i like play happy wheels demo online and play happy wheels games full and game zombie tsunami , retrica apk , retrica download , happy wheels demo , agario

Unknown said...

I found a lot of information here to create this actually best for all newbie here. Thank you for this information.
happy wheels , agario , happywheels , agar ,

Unknown said...

Thanks for your sharing. We feel very pleased about that. You should also try their best games with our free today to get the sense of fun that brings. Thank you!
Juegos de Matar Zombies
earn to die
earn to die 2
earn to die 3
earn to die 4
earn to die 1
earn to die part 2
earn to die 5
earn to die 6

Unknown said...

First You got a great blog.I will be interested in more similar topics.
Signature:
Download retrica app includes more than eighty different filters with many different styles and include retrica , and play zombie tsunami game is the ideal game for anyone who loves the running game genre

Unknown said...

Thanks for your sharing. We feel very pleased about that. You should also try their best games with our free today to get the sense of fun that brings. Thank you!
Vex 3 Game
Vex 3
Vex Game
Juegos de Matar Zombies
return man 3
return man 2
return man

MINHTRANG said...

Thanks for this post..Nice Stuff
snapchat
google play
play store


MINHTRANG said...

I think you'll love it!Thanks!

snapchat

baixar snapchat

baixar snapchat gratis

como usar o snapchat

download snapchat

snapchatdownload

snapchat online

baixar google

baixar google play

baixar google play gratis

baixar googleplay

download google play

googleplay

baixar googleplay gratis

baixar play store

play store


google play download



playstore baixar



play store download


Billy. said...

Rousing. I'm set for break out the old earth, myself. Much obliged for sharing.

shoes online

Akbar Khan said...

Thankyou For Informative Post Guide Step By Step