The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Maven note: exec-maven-plugin

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan Ransford

Posts: 71
Nickname: rdransfo
Registered: Jul, 2008

Ryan Ransford is a Java developer working in the enterprise looking to make the world a better place
Maven note: exec-maven-plugin Posted: Jan 23, 2011 5:42 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Ryan Ransford.
Original Post: Maven note: exec-maven-plugin
Feed Title: Active-Active Configuration
Feed URL: http://active-active.blogspot.com/feeds/posts/default
Feed Description: Active-Active Configuration is a blog about making my place in the enterprise world better. This blog is primarily focused on Java articles, but be prepared to be challenged by posts about dynamic languages, agile tools, and the lighter side of geek culture.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Ryan Ransford
Latest Posts From Active-Active Configuration

Advertisement

I'm currently working on a development package containing a series of .xsd files which will be used to define the external interface for our web service. Due to some other project constraints, it was decided that this package also needed to include the .wsdl files which will further define the web service.

I'm a lazy (the good kind) programmer, so I decided that I did not want to update these files every time the schema changed nor did I want to make anyone else figure it out later. I wrote a quick utility for creating the .wsdl files, based on the current .xsd files. Since we're already expecting to use Spring-WS for message dispatching, I wrote some file generation code around the org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition class and wrote up a Spring configuration which put it all together.

My next task was to figure out a way to get this utility to run within the context of the Maven package phase. Since the code needed to generate the .wsdl files was the only code in this development package, it made sense to hook into the prepare-package phase instead of the generate-sources phase. Now that I knew when the utility should run, I just needed to figure out a way to do it. One Google search later, and I had the exec-maven-plugin. This Maven plugin provides two goals which can be hooked into arbitrary phases in the Maven life cycle:

  • exec -- execute an arbitrary executable from within the Maven runtime
  • java -- execute the main method, with arguments, of a specified class, from within the Maven runtime

So I set up my pom as shown below, and ran mvn package. The end result was a .jar file which contained both the .xsd and the .wsdl files we need. One mvn deploy later and these files were now available to all who needed them.

pom.xml

exec-maven-plugin 1.2 prepare-package java my.utility.ClassName ${project.build.outputDirectory} ... ]]>

Read: Maven note: exec-maven-plugin

Topic: Product Development: Frequent Releases vs. Major Releases Previous Topic   Next Topic Topic: Software Linkopedia January 2011

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use