Graham Leggett:

I notice the struts v1.1-rc1 jars are included in the maven repository at

Does anyone have any instructions on using maven to include struts into a maven driven project?

I need to know what dependancies I must include in the project.xml, and what is to be done with the nightly build dependancies that are currently outstanding (in the case of commons-logging, there is no snapshot jar available, so in theory the struts.jar could never work as the dependancy could never be satisfied).

Does anyone have a maven -> struts howto anywhere?

Joe Germuska:

This actually turns out not to be a big deal, especially since all of the Commons projects are "mavenized". Here's what you do:

Check out the jakarta-commons and jakarta-commons-sandbox modules from the Apache CVS repository. (See for details.)

Then, in any Commons subdirectory, type "maven jar:install". This will build the JAR and put it in $MAVEN_HOME/repository for you. Then, unless your dependency is on version SNAPSHOT, Maven won't even go to iBiblio to look for it.

If you work with a team, a more complete solution would be to set up a local web server as an alternative repository. If you were planning on deploying Maven generated documentation of your projects to a server, that's a natural place to also put a repository. To get your Maven to check more than one repository for JARs, set this Maven property:


I've found it most appropriate to set it in the local "" file, but you can define it anywhere Maven will find it, including on the command line with "-D". Putting it in and putting that into CVS makes it easy for your whole team to keep in sync with JARs.

I seeded the local server with an exact copy of my $MAVEN_HOME/repository, and then added JARs as needed. This is a handy way to deal with Sun's licensing restrictions on things like JavaMail too – whether or not it's within the technical letter of the licensing agreement, if your local server is not open to the world, I doubt they'll give you a headache about redistributing those jars.

If you have the local repository, then instead of copying your JARs manually from $MAVEN_HOME/repository, you can deploy them directly with "maven jar:deploy" Just set these two additional properties (again, I like to put them in

This generally assumes that you can SSH to "" I'm pretty sure the "deploy" subgoal of "jar" has a filesystem alternative to SSH, but I haven't used it.

I've been working on a "genstruts" plugin along the lines of the "genapp" plugin which is distributed with Maven. It prepares a local project directory, including a project.xml with the many Struts dependencies already defined, plus sets up good default copies of web.xml, struts-config.xml with the validator and tiles plugins already there, and of course copies of the TLDs and DTDs, etc. It promises to save a bunch of time setting up a new project once we get it rolling. Before you ask for my copy – like I said, it's not ready yet. But if you look at the src for the "genapp" plugin and if you understand Ant at all, you should find it pretty easy to adapt to your local needs.

Hope this helps. We're finding Maven very helpful in getting our teams organized, and it makes it much easier for developers to use the IDE of their choice without needing to spend a lot of time setting up project files, since Maven can automatically generate JBuilder , Eclipse and IDEA project files as well as ANT build scripts.

Tim Chen:

Can someone recommend a good resource on using XDoclets, Maven and Struts together? I have looked at the Maven docs and the XDoclet docs and even did a bunch of google searches. There just doesnt seem to be any one good resource out there that can explain it well. Currently I'm stuck with using the jelly:ant task to define my webdoclet tasks rather than use the maven-xdoclet plugin. (sad)

Ryan Hoegg:

Joe, maven genapp now supports templates, so perhaps you should just create a template instead. If the genapp plugin isn't flexible enough for what you want to do, file a bug report in jira and I promise to take a look. (smile)

Peter Pilgrim

The Maven commands for Struts are the following

maven jar

maven war

maven dist

These command seem only to build the JAR and WAR files for Struts inside the directory For the following command show what is built on a Linux/Unix system

find . -name "*.[jw]ar"

The current Maven project.xml does not build any of the Struts Examples web applications or the Contribution directory targets. For these you still need to use ANT and the file. Sorry please don't blame me.

  • No labels