0

I have a project that consist of multiple modules (ejb's, jar's, war's) and I'm using a pom.xml of type "ear" to package them. It works perfectly fine and it generates an EAR-file with the correct jar's / etc. What I additionally need is a second EAR-file with source code of included modules... I tried to use the source plugin as follow but the generated EAR didn't include any sources:

            <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>

Funnily enough when I run "install" on my parent pom.xml, where all modules are included, the %MODULE_NAME%-sources.jar files are generated in my local maven repository. Is it possible to somehow reuse them and package into a second EAR?

7
  • 1
    An EAR with sources does not make sense, cause this can't be deployed into JEE container. You can create a jar with the sources. Apart from that a EAR module should not having source files at all.
    – khmarbaise
    Jun 10, 2014 at 15:02
  • You are right! Hmm is it possible to create some other archive (i.e. jar) with Maven that contains modules that are included in the EAR?
    – Blink
    Jun 11, 2014 at 6:51
  • You mean a jar or war module ? Yes.
    – khmarbaise
    Jun 11, 2014 at 7:30
  • jar would be sufficient. I just need to create an archive with all the modules and their sources. Any tip how to do it?
    – Blink
    Jun 11, 2014 at 7:40
  • I would suggest to take a look at the maven-assembly-plugin and the maven-dependency-plugin to got the source packages.
    – khmarbaise
    Jun 11, 2014 at 9:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.