aspose file tools*
The moose likes Struts and the fly likes Maven dependency - Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Maven dependency - Struts" Watch "Maven dependency - Struts" New topic
Author

Maven dependency - Struts

Dave Boden
Ranch Hand

Joined: Nov 08, 2000
Posts: 37
I'm building a webapp with Maven. At the moment, I've got all my dependencies setup so that I depend on struts, commons-validator, commons-beanutils etc. etc.

I also have to copy the .tld files into my build manually.

Does Struts provide a Maven2 pom.xml setup with the correct dependencies so that I can simply say "I want to depend on struts"? This would:
1. Copy the required .jar files into my target WEB-INF/lib
2. Copy the required .tld files into my target WEB-INF
Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156
I am trying to do the same thing.

The only difference is that I am working on Maven 1.0.2 and Struts 1.2.8.

I sure hope anybody can tell me how I can smoothly integrate what I downloaded from Struts (eg example application like the struts-mailreader) into Maven.

I am trying to put struts-mailreader into Maven�s complex application which is generated with Maven�s genapp.

I noticed that the libs in the Struts lib dir does not follow maven convention for jars.
Eg commons-logging comes as commons-logging.jar from Struts but according to Maven�s convention should be commons-logging-1.0.4.jar. Thus, I had to manually extract the jar to look into its manifest�to find out exactly what version of the jar it is�and then rename the jar�and then put that jar into my local Maven repository (.maven)�and then add the dependency xml config into maven�s project.xml. Imagine doing this for the many jars that Struts has/uses. This is both tedious and error prone.

Besides taking care of the jars, I need to also integrate the tlds, webapp etc etc.

Thanks in advance.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Yeah its fair to expect struts to provide a POM.xml
Did you check here

This is for struts2.7 though and hope 2.8 works with the same dependencies.
Dave Boden
Ranch Hand

Joined: Nov 08, 2000
Posts: 37
Many thanks for that. I've changed my dependency to 1.2.7 and everything now works as I'd expect.

Shame that there's no Maven 2 plugin that will copy the dependent .tld files into the WEB-INF directory under target as part of the war:war process. I've currently got them checked into my src/main/webapp/WEB-INF directory so that they get copied across.
Dave Boden
Ranch Hand

Joined: Nov 08, 2000
Posts: 37
Oh, by the way. The powers that be have now updated the 1.2.8 project so that it works as I'd expect. I guess that I just got unlucky and picked the week that they were sorting out the release onto ibiblio.

I would still like to see the <type>tld</type> dependencies folded into struts' pom.xml. We could always <exclude> them if we're not building a jsp app with struts (e.g. if we're using velocity or XML/XSLT). I'd imagine that the most common use case is to build jsps... and it doesn't harm the velocity or XML/XSLT approach to have the tld files sitting there anyway.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven dependency - Struts
 
Similar Threads
Using mvn with Taglibs and tld files in a webapp
problem with struts in weblogic
struts
sample build.xml file for Struts 1.1
problem in using JSTL 1.1 xml tags