0

I'm trying to build a jar file using 2 different source directories. So I'm using the maven-compiler-plugin. Here is my config:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <includes>
                    <include>**/*</include>
                    <include>src/main/java/**/*.java</include>
                    <include>../syncrpc/src/main/java/**/*.java</include>
                </includes>
            </configuration>
        </plugin>

It builds alright but my jar file is empty (almost)... and my usual "target/classes" dir is empty. I suppose by default the compiler creates this directory and puts all the packages with the built classes. Can I do manually when I use the maven-compiler-plugin?

Thank you

code-gijoe
  • 6,949
  • 14
  • 67
  • 103

1 Answers1

0

Found a solution: build-helper-maven-plugin

Basically, use the helper plugin instead, and it works perfectly.

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals><goal>add-source</goal></goals>
                    <configuration>
                        <sources>
                            <source>../syncrpc/src/main/java/com/gdevelop/gwt/syncrpc</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
Community
  • 1
  • 1
code-gijoe
  • 6,949
  • 14
  • 67
  • 103
  • Very bad design. You should rather bundle the GWT stuff in a separate module and depend on it. – Michael-O Aug 06 '11 at 09:24
  • Don't know how to make it work without having to compile the base project first. Anyways I just want a place to use the same source code for 2 projects which use the base (../syncrpc/src/main/java/com/gdevelop/gwt/syncrpc). – code-gijoe Aug 08 '11 at 13:40
  • Take the GWT source create a separate project, package and deploy it. Then use it as a dependency. But if you wrote all sources your self, you should think about a multi module project. – Michael-O Aug 08 '11 at 16:52