3
votes

I have a stateless EJB SOAP Web Service that is packaged in jar file.

Is it possible to setup auto-deploy with Tomee maven plugin when the app consists of only one EJB jar file?

For example, this site indicates that a web context defined in server.xml is required. My synch setup is same as the site suggests.

mvn compile

command does nothing but compile the sources as it normally does.

Is there a possibility to setup something like this with EJB jar or is a WAR package needed in any case?

Thanks.

UPDATE

In order to get the TomEE Maven plugin to work at all with jar files, I added the following in pom.xml configuration section

<apps>
  <app>my.group:my-ejb-app:1.0:jar</app>
</apps>
1

1 Answers

1
votes

We use the maven tomcat7 plugin to do exactly this. Here's the trick, because Apache TomEE is JEE6, you can deploy EJBs in wars.

So there are two ways to do what you want... One, skip the Jar packaging for your application and make your EJBs be WARs. If this doesn't sound appealing, the other way is to create a separate project that's a WAR, but pulls in your EJB jar as a dependency.

In either case, then you can then use the tomcat7 plugin to deploy your projects easily to Apache TomEE like this mvn tomcat7:deploy provided you fill out the server section of your pom correctly. Example:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <configuration>
                <server>crabs</server>
                <url>http://crabs/manager/text</url>
                <path>/${project.artifactId}</path>
                <update>true</update>
            </configuration>
        </plugin>
    </plugins>
</build>

Make sure you have a user in tomcat-users.xml on the server that has the proper deployment permissions to manager-text. Also, put the server configuration into your ~/.m2/settings.xml:

...
<servers>
    <server>
        <id>crabs</id>
        <username>deploy</username>
        <password>your password</password>
    </server>

...