You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christoph Nenning <Ch...@lex-com.net> on 2013/09/11 14:41:25 UTC

Trouble getting Archetype based project working

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

Re: Trouble getting Archetype based project working

Posted by Lukasz Lenart <lu...@apache.org>.
The README is a bit outdated (please register an issue), you can simple run:

mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/

and select archetype from the list, I'm using it all the time (but
with IDEA so I don't have a problems with Maven based projects)


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/9/11 Christoph Nenning <Ch...@lex-com.net>:
> 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

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