5

I have an EJB-maven-Project that has some generated classes (generated by JAXB). They are generated into: target/generated-sources/jaxb/

Now, with maven-ejb-plugin I want them (i.e. their compilated classes) to be included into the client-jar, something like that:

       <plugin>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <!-- Tell Maven we are using EJB 3.1 -->
                <ejbVersion>3.1</ejbVersion>
                <generateClient>true</generateClient>
                <clientIncludes>
                    <clientInclude>com/bla/ch/authorization/client/**</clientInclude>
                    <clientInclude>target/generated-sources/jaxb/**</clientInclude>
                </clientIncludes>
            </configuration>
        </plugin>

This does not work, the generated classes are not part of the ejb-client-jar. (Though they are in the ejb-jar). How can I do this correctly?

Rémy Schumm
  • 151
  • 1
  • 11

1 Answers1

0

Include sources in your jar is probably not a good solution.

You may add generated sources in you resources locations, and then use source-plugin, to generate the so called artifact-sources.jar

<resources>
    <resource>
        <directory>${basedir}/target/generated-sources</directory>
        <filtering>true</filtering>
    </resource>
</resources>
     [...]
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

This is a better way than producing a jar with source code.

Jean-Rémy Revy
  • 5,607
  • 3
  • 39
  • 65
  • Sorry, I was not precise enough. Of course I don't wan't the sources im my jar (that's another problem), but the compiled classes of the generated sources. Those classes are included automatically in my `authorization-ejb-0.0.1-SNAPSHOT.jar` - but not in my `authorization-ejb-0.0.1-SNAPSHOT-client.jar` – Rémy Schumm Nov 06 '12 at 09:27
  • maybe a solution: according to http://mojo.codehaus.org/jaxb2-maven-plugin/xjc-mojo.html let's generate the code into a normal src-location, i.e. `src/main/java` and include it as a `` in the maven-ejb-plugin. – Rémy Schumm Nov 07 '12 at 12:31
  • Maybe, this will help: http://stackoverflow.com/questions/8587353/maven-how-to-handle-generated-sources-for-testonly?rq=1 – Rémy Schumm Nov 21 '12 at 08:25