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>

25 comments:

Siarhei Dudzin said...

Hi,

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

Siarhei

products said...

China Wholesale has been described as the world’s factory. This phenomenom is typified by the rise ofbusiness. Incredible range of products available with China Wholesalers “Low Price and High Quality” not only reaches directly to their target clients worldwide but also ensures that wholesale from china from China means margins you cannot find elsewhere and buy products wholesaleChina Wholesale will skyroket your profits.wedding dressescheap naruto cosplayanime cosplaycheap Gemstone Jewelry

Whatsapp Descargar said...

I'm happy about everything you bring it very interesting and helpful, thanks
Signature:
download free descargar whatsapp and download baixar whatsapp online and descargar whatsapp gratis , baixar whatsapp gratis

games unblocked said...

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

Mít Trang said...

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

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

Piano Tiles 2 said...

Thanks for this help. Hope so that this will help me in my next project. I like play game piano tiles | Piano Tiles | piano tiles 2 game | piano tiles | piano tiles 2 | Dream League Soccer | Score Hero | Score Hero game | Score Hero | Score Hero | Score Hero game | piano tiles 2 | piano tiles 2 game | so much. How about you? B612 | camera b612 | descargar b612 | b612 | b612 | descargar b612 gratis | camera b612 | Dream League Soccer | B612 lets you make collages with your pictures. You can make them with just a regular selfie or a composition of up to nine photographs, and even vertical compositions of two or three pictures.

Br Agario 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 ,

Earn To Die 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

Man 3 Return 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
return man 3
return man 2
return man

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

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

return man 3

fancy pants 3

Watergirl Fireboy said...

Thanks for sharing this valuable information to our vision.
fireboy and watergirl | super smash flash 2 , fireboy watergirl | ssf2 and minecraft 2 , minecraft , minecraft 2 download , minecraft 2 baixar

Game Vex 3 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


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

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



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


bui loan said...

This is a great website. Good sparkling user interface and very informative blogs. I will be coming back in a bit, thanks for the great article. I have found it enormously useful.Hill Climb Racing, Clash of Kings, Photo Grid, baixar mobogenie, Happy Wheels 4, Dream League Soccer

Trần Mi said...

The article gives me a lot of interesting information. I still often share life experiences with friends. And I enjoyed the convenience and attractiveness of free messaging app
whatsapp baixar , baixar whatsapp , baixar whatsapp gratis

Trần Mi said...

Facebook has become a part of my life, not only helped me to connect with you but also where I can share every moment in life. I really like the convenience that it brings
facebook baixar , baixar facebook , baixar facebook gratis

Linh Hoa said...


I wanted to thank you for this excellent read!! I definitely loved every little bit of it.Cheers for the info!!!! & This is the perfect blog for anyone who wants to know about this topic
baixar facebook , baixar facebook gratis , facebook baixar ,

Linh Hoa said...

Your article made me very impressed. I enjoyed it, I would expect at your website, or more articles
return man 2 game , return man 2 , return man ,

Linh Hoa said...

In your article, points caught my attention the most is how your prose, to give me a deep impression. Wish you would write more. good luck!
subway surfers game , subway surfer , subway surfers ,