ChrLipp
ChrLipp

Reputation: 15668

Maven command: mvn tomcat:run

When using mvn tomcat:run, Maven downloads the Tomcat bundles into the target directory and the plugin starts this Tomcat instance with the web project. This Tomcat instance is not visible in Eclipse's server view.

But I have a local Tomcat 6 installed, can I configure the Tomcat Plugin in a way that it uses this local Tommcat instance (under CATALINA_HOME) instead of installing a new version into the target project?

Upvotes: 3

Views: 14863

Answers (2)

ChrLipp
ChrLipp

Reputation: 15668

This is by design. The official doc for tomcat:run says:

When developping a war project, you usually build your war and deploy it to an installed Tomcat instance. This is time and resources consuming and take time to install locally the instance. The run mojo give you the opportunity to save that by simply running your war inside an embeded Tomcat instance in your Maven build.

So I have to start the installed Tomcat instance in the server view and then the maven plugin is using this server instance for goals other then tomcat:run.

Upvotes: 2

thejartender
thejartender

Reputation: 9379

1)upgrade your Tomcat to Tomcat 7,

2)Configure your Tomcat users.xml to include a set of credentials :

<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="manager"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="admin"/>

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user password="password" roles="manager-gui, manager-script, manager-jmx, manager-status, manager, admin-gui, admin-script, admin" username="admin"/>
</tomcat-users>

Your Maven .settings.xml:

<server>
        <id>local_tomcat</id>
        <username>admin</username>
        <password>password</password>
    </server>

Create a new 'dev' profile with new Tomcat plugin:

<profile>
        <id>dev</id>
        <build>
            <finalName>tjb</finalName>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat-maven-plugin</artifactId>
                        <version>2.0-beta-1</version>
                        <configuration>
                            <url>http://localhost:8080/manager/text</url>
                            <server>local_tomcat</server>
                            <path>/</path>
                        </configuration>


                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.1.1</version>
                    </plugin>

                </plugins>
            </pluginManagement>
        </build>
    </profile>

Upvotes: 0

Related Questions