You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "PS M." <tr...@gmail.com> on 2011/12/27 03:48:29 UTC

tomcat7 maven plugin (frustration) - probably a simple question

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

Re: tomcat7 maven plugin (frustration) - probably a simple question

Posted by Patrick Moore <pa...@amplafi.com>.
O.k. I will try today

Re: tomcat7 maven plugin (frustration) - probably a simple question

Posted by Olivier Lamy <ol...@apache.org>.
Hello,

Does your current project have war packaging ? If yes, I think there
are some issues with that and btw use exec-war-only goal to prevent to
run an other full lifecycle in your war project.
What I recommend is to have an other project with packaging pom and
construct the exec war.
I have pushed samples here: https://github.com/olamy/translate-puzzle .

2011/12/27 PS M. <tr...@gmail.com>:
> 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



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org