[ http://jira.codehaus.org/browse/MEJB-3?page=comments#action_81901 ] 
            
Sam Wilson commented on MEJB-3:
-------------------------------

Alright. I've got this working with the maven-assembly-plugin as my workaround. 
I am deploying to JBoss and so far this is working for me.

Basically, in your POM you want to to include the following:

[pom.xml]
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <!-- include dependencies in manifest classpath -->
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
        </configuration>
      </plugin>
      
      <!-- utilize maven assembly plugin to include dependency jars for 
standalone ejb-jar deployment -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/assembly.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>package-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>attached</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
[/pom.xml]

Then, you'll have to create a directory called ${root.dir}/src/assembly and in 
there create a file named assembly.xml with the following:

[assembly.xml]
<?xml version="1.0" encoding="UTF-8"?>

<assembly>
  <id>jar-with-dependencies-packed</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <scope>runtime</scope>
      <excludes>
        <!-- for some reason the assembly plugin includes the actual jar for 
the project which causes JBoss to 
               try and register the EJB twice. we exclude it here so that we 
don't run into this error on startup/redeploy -->
        <exclude>${pom.groupId}:${pom.artifactId}</exclude>
      </excludes>
    </dependencySet>
    
  </dependencySets>
  <fileSets>
    <fileSet>
      <!-- include the code for the EJB -->
      <directory>target/classes</directory>
    </fileSet>
  </fileSets>
</assembly>
[/assembly.xml]

I still think the plugin should be fixed, but I hope this helps people. If the 
plugin isn't going to be fixed, then perhaps this info should be posted to the 
site so that people are aware of a workaround for this feature.

> Add ejb bundle feature like in maven 1
> --------------------------------------
>
>                 Key: MEJB-3
>                 URL: http://jira.codehaus.org/browse/MEJB-3
>             Project: Maven 2.x Ejb Plugin
>          Issue Type: New Feature
>         Environment: windows
>            Reporter: Alexandre Vivien
>
> It could be nice if we could include dependencies in the ejb jar produce by 
> the ejb plugin. In fact, I think an ejb bundle feature like in Maven 1 will 
> be useful. We could use the dependencies scope or whatever. (Perhaps it can 
> be handy to add a new scope name "bundle" that could be use with ejb, war and 
> ear plugin ???? )
> Thanks.
> Alexandre Vivien

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to