aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Migrating a project from Ant to Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Migrating a project from Ant to Struts" Watch "Migrating a project from Ant to Struts" New topic
Author

Migrating a project from Ant to Struts

Praneet Mirchandani
Ranch Hand

Joined: Dec 16, 2009
Posts: 46

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

Thanks,
Praneet
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

/src/main/webapp

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

(What would a Struts plugin *do*?)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

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
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Jun 25, 2001
Posts: 16305
    
  21

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
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh, hmm, I didn't know that about the archetypes--interesting.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Migrating a project from Ant to Struts