struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Trouble getting Archetype based project working
Date Wed, 11 Sep 2013 12:41:25 GMT
Dear List,


today I had some trouble getting a new project working based on a maven 
archetype.

I must admit that I don't have much maven experience, so some of this may 
be n00b supidity.
I'm posting this anyway in the hope that it helps others.

It may be even worth to put parts of this in the wiki?



First of all I wanted to use the converter-plugin archetype from svn 
trunk.

After reading 
https://struts.apache.org/release/2.0.x/docs/struts-maven-archetypes.html
and
http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_15_1/archetypes/struts2-archetype-convention/README.txt

I tried some different repository URLs. What finally worked was this:


mvn archetype:generate -B -DgroupId=foo \
        -DartifactId=bar \
        -DarchetypeGroupId=org.apache.struts \
        -DarchetypeArtifactId=struts2-archetype-convention \
        -DarchetypeVersion=2.3.15.1 \
 -DremoteRepositories=http://svn.apache.org/repos/asf/struts/struts2/tags/

so, actually not trunk but the most recent tag. But I don't understand how 
maven constructs the final archetype URL from this parameters. Anyway, I 
got this part working.

There was a Windows issue which caused some other trouble. Windows cmd 
uses ^ as escaping character, instead of \. But to make the project 
creation work I could not use escaping. The whole thing had to be put in 
one single line.


Afterwards I tried to import that project in eclipse.
The most recent eclipse version is 4.3 (kepler), which I cannot use due to 
3rd party plugins I need.

To make struts2 archetype projects work one needs 2 eclipse plugins:
- m2e
- m2e-wtp
(in fact you need a lot more wtp-whatever plugins to get JavaEE support, 
but I think everybody has that)


The versions of those 2 plugins bundled with eclipse 4.2 cannot handle 
struts2 archetypes. Here you can create eclipse project files on the 
command line:
mvn eclipse:eclipse -Dwtpversion=1.5

Then import the project with "General -> Import existing project"


Fortunately the maven-plugins have been improved a lot during last year. 
If you use eclipse 4.3 you get the new plugins automatically. You can 
install the new plugins in eclipse 4.2 with an update site found here:
https://www.eclipse.org/m2e-wtp/download/


With the most recent plugins in place you can create your new project 
without commandline.

Choose:
New -> Other -> Maven Project
On the 3rd wizard page there is a button called "Add Archetype". You can 
insert the above parameters there.

To avoid that eclipse takes ages to download other archetypes you should 
switch the Catalog field to "Default Local".




Regards,
Christoph

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message