Issue Details (XML | Word | Printable)

Key: MOJO-384
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Hobson
Reporter: Jurgen Lust
Votes: 4
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Mojo

New goal 'run', which starts an embedded tomcat

Created: 28/Apr/06 05:43 PM   Updated: 07/Dec/06 03:51 PM
Component/s: tomcat
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File tomcat-embedded.patch (62 kB)


Complexity: Intermediate


 Description  « Hide
This patch adds a 'run' goal, which starts an embedded tomcat, using the project's classpath, and the src/main/webapp directory as context root. The advantage of this goal is that you don't need an installation of Tomcat, the mojo handles everything for you

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Sam Wilson added a comment - 17/Nov/06 02:44 PM
Has this patch been applied at all?

This functionality would be incredibly useful.


Matt Raible added a comment - 17/Nov/06 02:48 PM
I'd love to see this patch applied, so it'd be possible to do "tomcat:run" like you do "jetty:run". I'd also like to see a run-war if possible, so merging WARs with the war-plugin works.

Valerio Schiavoni added a comment - 17/Nov/06 08:01 PM
this patch is very useful to early evaluate the cross-application-server compatibility of your webapps. please apply it

Mark Hobson added a comment - 20/Nov/06 06:07 AM
Apologies for the inactivity, I'll try to find some time to apply the patch soon.

Mark Hobson added a comment - 26/Nov/06 04:58 PM
Applied with changes, thanks!

I've opened MOJO-567 for tomcat:run-war.


Valerio Schiavoni added a comment - 28/Nov/06 04:38 AM
i've just tested it (from the latest mojo snapshot). the new goal works just fine, but it introduces a minor problem (for me, at least): compiled classes and all the files needed to launch the applications are kept on the main sources tree. This causes a mix of sources and compiled class files in the same directory.

would it be possible to clean them on exit ?


Mark Hobson added a comment - 28/Nov/06 04:53 AM
I'm not sure I understand your scenario - which sources and classes are being mixed?

Valerio Schiavoni added a comment - 28/Nov/06 06:50 AM
sorry Mark,
i've confused the files i was looking at as being part of the sources tree. please ignore my previous comment.

Valerio Schiavoni added a comment - 28/Nov/06 08:28 AM
ok, this is a concrete issue: using tomcat:run, the application is deployed in an 'anonymous' context, that is the finalName property (specified in the pom) is being ignored.
Even forcing it with:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<path>/my-webapp</path>
</configuration>
</plugin>

once tomcat starts, the application is available at:
http://localhost:8080/index.jsp

and not
http://localhost:8080/my-webapp/index.jsp

as I was expecting. is this intended ? If so..why ?


Mark Hobson added a comment - 28/Nov/06 08:41 AM
Yep I noticed this too - this was how the original patch worked. I was going to add support for finalName and path soon. Is this a blocker for you right now?

Valerio Schiavoni added a comment - 28/Nov/06 11:53 AM
actually it is: i have some paths used by ajax invocation, and i hard-coded (poor me) the context name as part of the URL..

Mark Hobson added a comment - 29/Nov/06 04:36 AM
Okay, I'll try to fix it sometime today for you.

Mark Hobson added a comment - 30/Nov/06 02:54 PM
Fixed and deployed - see new 'path' config param:

http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html


Matt Raible added a comment - 30/Nov/06 03:04 PM
Does this plugin have a scanInterval setting like the Jetty Plugin does?

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<scanIntervalSeconds>3</scanIntervalSeconds>
</configuration>
</plugin>


Mark Hobson added a comment - 30/Nov/06 03:07 PM
Not yet, but feel free to open a new JIRA issue for this enhancement.

Valerio Schiavoni added a comment - 01/Dec/06 06:54 AM
thanks mark, it works as expected now.

Sam Wilson added a comment - 07/Dec/06 03:51 PM
Great work.

I had to jump through some hoops to be able to run my app against POJOs instead of EJBs when deployed this way. Now that I've got it working, things are so much easier.

Thanks for making it happen on this end. This will save me a ton of time.