struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Germuska <...@Germuska.com>
Subject Re: Struts and Maven
Date Sat, 03 May 2003 19:17:17 GMT
At 8:01 PM +0200 5/3/03, Graham Leggett wrote:
>Hi all,
>
>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).

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.

Joe
-- 
--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"If nature worked that way, the universe would crash all the time." 
	--Jaron Lanier

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message