• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Migrating a project from Ant to Struts

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I am trying to migrate a project from Ant to Maven.

The framework we are using is Struts. For the front end, have used Tiles, JSPs, Javascript, CSS. Database is queried using SQL files.

The project has 3 parts - of which I have managed to migrate the first part. It wasnt too complex. We arent using JUnits, so I am not concerned with test classes and test resources.

I am confused about the second part.

The default directory structure of Maven is:

project home - which contains pom.xml

src\main\java - which contains the Java sourcecode

src\main\resources - which contains property files

What I am confused about is - where do I put the Tiles, JSPs, Javascript, CSS, and SQL files???

If I make a separate folder for them, how do I include that in the pom.xml file?

Another option I just thought of - would be to stuck to the existing directory structure of the project, and just make changes in pom.xml. But I dont think this is recommended since the Java code, SQL code, Tiles etc are in different places and in pom.xml, only the java and resources location can be specified.

Any suggestions?

Thanks,
Praneet
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/src/main/webapp

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
WARs are produced by the WAR plugin, and it has some particular directory structure needs that augment those for a generic Maven project. Most notably, everything in src/main/webapp will be used as boilerplate (copied verbatim) into the target WAR. I don't think the WAR plugin uses src/main/resources.

I have never built a Struts app with Maven, since by the time I finally made my peace with Maven, I'd already migrated to JSF. However, if you search the documentation for Maven plugins, I would not be surprised if you found one for Struts. You will definitely find documentation for the WAR plugin.

Just be careful. Web searches often bring up results for Maven 1 plugins and things changed a lot for Maven 2.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(What would a Struts plugin *do*?)
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:(What would a Struts plugin *do*?)



Run XDoclet, for one. Which is what the Maven1 plugin did. Or its modern-day equivalent.

I did a quick google, and there's at least one struts2 archetype in the current list.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, are archetypes considered plugins? I guess I would have said an archetype uses the archetype plugin, but isn't one.

(Of course, I would have also thought that there'd have been a separate XDoclet plugin and you'd just use it during a Struts 1 build, which shows how much I know.)
 
Tim Holloway
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Oh, are archetypes considered plugins? I guess I would have said an archetype uses the archetype plugin, but isn't one.

(Of course, I would have also thought that there'd have been a separate XDoclet plugin and you'd just use it during a Struts 1 build, which shows how much I know.)



Actually, I think technically, they are, but that's purely incidental. What they indicated to me was that they were capable of setting up projects with Struts plugins.

Although a generic XDoclet plugin would be reasonable, Maven tends towards a more high-level approach, so a Struts plugin would be most likely to pull in an XDoclet plugin as one of its dependencies, then apply it in a way that made sense for Struts.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, hmm, I didn't know that about the archetypes--interesting.
 
reply
    Bookmark Topic Watch Topic
  • New Topic