« Return to Thread: Deploy assembly to glassfish

RE: Deploy assembly to glassfish

by Marcin Kwapisz-2 :: Rate this Message:

Reply to Author | View in Thread

> a sample project demonstrating the setup, files as issue in netbeans
> issue tracking system
> (http://www.netbeans.org/issues/enter_bug.cgi?component=maven)
> would help.
[Marcin Kwapisz]
I will try to describe the problem and a workaround here.

1. ejb-plugin configuration

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <generateClient>true</generateClient>
                    <clientIncludes>
                        <clientInclude>pl/zsk/sos/ejb/endpoint/*Remote.class</clientInclude>
                    </clientIncludes>
                    <ejbVersion>3.0</ejbVersion>
                </configuration>
            </plugin>

2. Assembly plugin configuration
<plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2-beta-2</version>
                        <executions>
                            <execution>
                                <id>create-ejb-module</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <archiverConfig>
                                        <duplicateBehavior>fail</duplicateBehavior>
                                    </archiverConfig>
                                    <descriptors>
                                        <descriptor>src/main/assembly/ejbModule.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

The ejb-plugin creates two jars:
PersonAccountModule-1.0-SNAPSHOT.jar
PersonAccountModule-1.0-SNAPSHOT-client.jar

The assembly-plugin creates third jar:
PersonAccountModule-1.0-SNAPSHOT-ejb-with-dependencies.jar
The name of this jar is ${project.build.finalName}-assembly_id.jar, where assembly_id is assembly id in ejbModule.xml descriptor (ejb-with-dependencies, see below)

3. Assembly descriptor (ejbModule.xml)

<?xml version="1.0" encoding="UTF-8"?>
<assembly>
    <id>ejb-with-dependencies</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
            <outputFileNameMapping></outputFileNameMapping>
            <useProjectArtifact>false</useProjectArtifact>
            <unpack>true</unpack>
            <unpackOptions>
                <excludes>
                    <exclude>**/META-INF/*.xml</exclude>
                </excludes>
            </unpackOptions>
            <scope>runtime</scope>
            <useTransitiveDependencies>false</useTransitiveDependencies>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory></outputDirectory>
        </fileSet>
    </fileSets>
</assembly>

In that situation NB65 tries to deploy on Glassfish PersonAccountModule-1.0-SNAPSHOT.jar, what is wrong.
The workaround is very simple -> assembly_id in assembly descriptor should be empty
...
<assembly>
    <id></id>
    <formats>...

PersonAccountModule-1.0-SNAPSHOT.jar created by the ejb-plugin is overwritten by a jar created by the assembly-plugin now, so the correct one is deployed on Glassfish.

I do not know if it is correct to have empty id in assembly descriptor, but it works.

Regards
--
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Deploy assembly to glassfish