Sachin
Sachin

Reputation: 18747

How to specify an instance of Tomcat to 'mvn tomcat:run' command?

When using the Maven plugin, we can start Tomcat from command line using this:

mvn tomcat:run

If I have 2 separate installations of Tomcat on my machines, (say Tomcat 6.x and 7.x), is there a way I can specify which one to :run???

EDIT 1:

As sugested ny Cyril, I tried:

mvn tomcat6:run and mvn tomcat7:run

And I got this error:

[ERROR] No plugin found for prefix 'tomcat6' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/chitteb/.m2/repository), central (http://repo1.maven.org/maven2)] -> [Help 1]

Upvotes: 2

Views: 7487

Answers (4)

Abhijit
Abhijit

Reputation: 683

Add below lines in your pom.xml. i was also facing same issue later it resolved

use mvn tomcat7:run

  <build>
        <plugins>
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.2</version>
            </plugin>   
        </plugins>
    </build>

Upvotes: 1

user944849
user944849

Reputation: 14951

I found an example of how to adjust tomcat version in the Apache Tomcat Maven plugin documentation. If the plugin was configured as shown in the example, you could then specify the version on the mvn command line with -Dtomcat.version=6.0.xxx or by defining the property in a profile as mentioned by @Seshagiri.

Upvotes: 1

Seshagiri
Seshagiri

Reputation: 748

You may need to define two different settings by using profiles and use profile name while running.

Upvotes: 1

Cy Pangilinan
Cy Pangilinan

Reputation: 572

I believe it will run the one specified in CATALINA_BASE and CATALINA_HOME environment variables.

Upvotes: 1

Related Questions