Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn tomcat:run doesn't start Tomcat

I am trying to deploy and run my webapplication using maven and its tomcat plugin.

I have set it up in project's pom.xml, but when I'm calling it from command line:

mvn tomcat:run

all that I get is:

[root@ovz6022 trunk]# mvn -e tomcat:run
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.gotbrains.breeze:breeze:jar:1.0
[INFO]    task-segment: [tomcat:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing tomcat:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/trunk/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [tomcat:run {execution: default-cli}]
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24 seconds
[INFO] Finished at: Thu Jul 23 14:34:31 MDT 2009
[INFO] Final Memory: 7M/14M
[INFO] ------------------------------------------------------------------------

And that's all. Tomcat hasn't been launched but I don't see any errors here.

Does anybody knows what's happening?

like image 306
glaz666 Avatar asked Jul 23 '09 20:07

glaz666


2 Answers

As mentioned before, you should use war packaging. However, if you can't because you're using OSGI or some other reason, you can tell the Tomcat plugin to deploy anyway even if it isn't war packaging by using the ignorePackaging option:

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat6-maven-plugin</artifactId> 
                <version>2.0</version>
                <configuration>
                    <ignorePackaging>true</ignorePackaging>
like image 139
user64141 Avatar answered Sep 17 '22 22:09

user64141


The clue is in the line:

[INFO] Skipping non-war project

The tomcat:run goal is intended to work with war projects, I'm guessing yours is a jar project.

You need to change the packaging of your project to war, you may also need to provide some additional configuration for the war to actually do anything.

Note: I'd recommend having a separate war project to your jar projects, then adding the jars as dependencies to the war.

like image 45
Rich Seller Avatar answered Sep 18 '22 22:09

Rich Seller