Reputation: 483
I am developing JSR 268 compliant portlet and utility with eclipse. Now, the utility is designed to be a separate JAR from the portlet itself.
Does anyone now how to write an ant build.xml that will 1. Compile and JAR my utility class 2. Move the JAR to the ./lib folder of the portlet 3. Compile and maybe even delpoy the portlet to a tomcat running on localhost?
My biggest problem right now are the build-time dependencies. I dont want to hardcode all the folders as I share this project with two other developers which are on another platform. Is it possible to reuse the buildpath from eclipse?
Thank you in advance, Felipe
Upvotes: 14
Views: 29534
Reputation: 3567
For 1. Just use the and Ant tasks
For 2. Is it on a remote server? How do you get it there? Windows share?
For 3. Set up the Tomcat manager and then use Tomcat's deploy/undeploy Ant tasks: http://blog.techstacks.com/2009/05/tomcat-management-setting-up-tomcat.html
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" />
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" />
If you want to avoid hard-coding paths, try to use relative paths. Where are you dependencies right now? What do you feel you may have to specify an absolute path for?
Upvotes: 0
Reputation: 7541
Though you probably have figured something out by now, for future references I would suggest taking a look at Eclipse's ability to use Ant files as project builders.
An advantage of this is, that will happen automatically as you build and since you only pack and copy the jar file, you don't have to worry about changes in e.g. the class paths, as you would in the two previous answers
right click > properties > project references
When you build the following will now happen:
Upvotes: 0
Reputation: 358
In Eclipse, Goto Window->preference->Ant->Runtime->Classpath->ant Home Then add what are the thing u need to add,atlast click ok button to create ant file.
Upvotes: -1
Reputation: 37004
Does this wizard help
Rigth-click on project -> Export ... -> Ant buildfiles.
?
Upvotes: 19