Differences between revisions 3 and 4
Revision 3 as of 2005-03-22 05:48:35
Size: 5774
Editor: anonymous
Comment: missing edit-log entry for this revision
Revision 4 as of 2009-09-20 23:12:21
Size: 5776
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 52: Line 52:
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 [http://jira.codehaus.org/secure/BrowseProject.jspa?id=10334 jira] and I promise to take a look. :) 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 [[http://jira.codehaus.org/secure/BrowseProject.jspa?id=10334|jira]] and I promise to take a look. :)

Graham Leggett:

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

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 http://jakarta.apache.org/site/cvsindex.html 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:

maven.repo.remote=http://local.server.com/repository,http://www.ibiblio.org/maven

I've found it most appropriate to set it in the local "project.properties" file, but you can define it anywhere Maven will find it, including on the command line with "-D". Putting it in project.properties 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 project.properties):

maven.repo.central=local.server.com maven.repo.central.directory=/path/to/local.server.com/repository

This generally assumes that you can SSH to "local.server.com." 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. :(


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. :)


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"
  • /m-target/struts-1.2.1-dev.jar
  • /m-target/struts/WEB-INF/lib/commons-beanutils-1.6.1.jar
  • /m-target/struts/WEB-INF/lib/commons-collections-2.1.jar
  • /m-target/struts/WEB-INF/lib/commons-digester-1.5.jar
  • /m-target/struts/WEB-INF/lib/commons-fileupload-1.0.jar
  • /m-target/struts/WEB-INF/lib/commons-logging-1.0.3.jar
  • /m-target/struts/WEB-INF/lib/commons-validator-1.1.3-dev.jar
  • /m-target/struts/WEB-INF/lib/oro-2.0.7.jar
  • /m-target/struts/WEB-INF/lib/xml-apis-2.0.2.jar
  • /m-target/struts/WEB-INF/lib/antlr-2.7.2.jar
  • /m-target/struts.war
  • /m-target/struts-1.2.1-dev/bin/struts-1.2.1-dev/struts-1.2.1-dev.jar

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 build.properties file. Sorry please don't blame me.


StrutsAndMaven (last edited 2009-09-20 23:12:21 by localhost)