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?

Blink
  • 1,408
  • 13
  • 21
  • 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 '14 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 '14 at 06:51
  • You mean a jar or war module ? Yes. – khmarbaise Jun 11 '14 at 07: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 '14 at 07:40
  • I would suggest to take a look at the [maven-assembly-plugin](http://maven.apache.org/plugins/maven-assembly-plugin/) and the [maven-dependency-plugin](http://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html) to got the source packages. – khmarbaise Jun 11 '14 at 09:05
  • I've tried to use maven-dependency-plugin but it gives me error for my "war" modules because they don't consist sources classifier: ` ${project.groupId} ${project.artifactId} ${project.version} ${project.packaging} sources ../PKM-parent/target/dependencies ` – Blink Jun 11 '14 at 09:14
  • with this setup you would like to add the sources of your own project where i assume you don't create the sources packages. Take a look at the maven-sources-plugin. – khmarbaise Jun 25 '14 at 07:37

0 Answers0