zjffdu
zjffdu

Reputation: 28824

How to include a provided denpendency when debug webapp using maven tomcat plugin?

I have webapp which has a jdbc driver dependency. And this is dependency's scope is provided. So when I use maven tomcat plugin to run it, it is not include in my local. So how can I include this provided plugin when I debug it using maven tomcat plugin ?

Thanks

Upvotes: 3

Views: 117

Answers (2)

ChrLipp
ChrLipp

Reputation: 15668

Instead of using a profile I prefer specifying the dependencies for the plugin directly:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>tomcat-maven-plugin</artifactId>
   <dependencies>
       <!-- add here your JDBC drivers which appear
            in the global dependencies with state provided -->
   </dependencies>
</plugin>

Upvotes: 0

Raghuram
Raghuram

Reputation: 52655

One way to do this would be to use a profile for debugging using tomcat. In this you can specify the required dependency with the needed scope. Something like this...

   <profile>
        <id>tomcat</id>
        <dependencies>
            <dependency>
                <groupId>myGroup</groupId>
                <artifactId>myArtifact</artifactId>
                <version>a.b.c</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>tomcat-maven-plugin</artifactId>
                    <version>1.1</version>
                </plugin>
            </plugins>
        </build>
    </profile>

Upvotes: 2

Related Questions