Hi there --

I am frustrated with the tomcat7 maven plugin. I am trying to create an
executable jar from my war project. The problem is that none of the war's
dependencies are included in the executable jar even though the
corresponding war created at the same time is complete.

In the pom.xml file:

<project>
....
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>tomcat-run</id>
                        <goals>
                            <goal>exec-war</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <path>/</path>
                            <attachArtifactClassifier>
                                exec-war<!-- default -->
                            </attachArtifactClassifier>
                            <attachArtifactClassifierType>
                                jar<!-- default value is jar -->
                            </attachArtifactClassifierType>
                            <warRunDependencies>
                                <warRunDependency>
                                    <dependency>
                                        <groupId>com.my-company</groupId>
                                        <artifactId>wireservice</artifactId>

<version>${project.version}</version>
                                        <type>war</type>
                                    </dependency>
                                    <contextPath>/</contextPath>
                                </warRunDependency>
                            </warRunDependencies>
                            <!-- naming is disable by default so use true
to enable it -->
                            <enableNaming>true</enableNaming>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

The generated executable has a this structure:
820944 Mon Dec 26 18:28:42 PST 2011 .war
    183 Mon Dec 26 18:28:42 PST 2011 tomcat.standalone.properties
     0 Mon Dec 26 18:28:44 PST 2011 META-INF/
   394 Mon Dec 26 18:28:44 PST 2011 META-INF/MANIFEST.MF
     0 Mon Dec 26 18:28:44 PST 2011 javax/
     0 Mon Dec 26 18:28:44 PST 2011 javax/annotation/
     0 Mon Dec 26 18:28:44 PST 2011 javax/annotation/security/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/annotation/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/descriptor/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/http/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/jsp/
     0 Mon Dec 26 18:28:44 PST 2011 javax/servlet/resources/
     0 Mon Dec 26 18:28:44 PST 2011 org/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/authenticator/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/comet/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/connector/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/core/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/deploy/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/filters/
     0 Mon Dec 26 18:28:44 PST 2011 org/apache/catalina/loader/
.... ( tomcat 7 exploded into classes )

The ".war" file has just the the classes in the current project included.
No dependencies are included as jars or exploded in any other form.

java -jar ____.jar starts tomcat but the war servlet is does not respond on
http://localhost:8080/ and in any event it would not be able to run because
of the missing dependencies.

So 2 questions:

   1. How to get the tomcat7-maven-plugin to include the war's
   dependencies. ( fyi the dependencies in question have the default scope )
   2. How to get the path correctly so that http://localhost:8080/ is
   responded to?

Thanks!

Pat

Reply via email to