Maven-ejb-plugin: enable generated sources

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

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

  <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. (Although they are in ejb-jar). How can I do it right?

+4
source share
1 answer

Including sources in a bank is probably not a good solution.

You can add the generated sources to your resources, and then use the source-plugin to create 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 creating a jar of source code.

0
source

Source: https://habr.com/ru/post/1444163/


All Articles