maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <baerr...@gmail.com>
Subject Re: Multi Module Project Failing - Help Me
Date Wed, 14 Dec 2011 22:48:38 GMT
On Thu, Dec 15, 2011 at 8:06 AM, Daivish Shah <daivish.shah@gmail.com> wrote:
> Hi Barrie,
>
> I got the real problem but still looking for solution.
>
> module1 is XSD type project means it generates classes file and JAR file
> based on XSD information.
>
> And i am defining module1 project as dependency of module2 project, Still
> my eclipse is giving compilation error on import statement of module1
> package files in module2 project.

There is your problem right there.
This is an Eclipse problem not Maven.

p.s when you say "I got the real problem but still looking for
solution.", it would be handy for the archives for you to detail what
you did so that others searching the internet can find the answers for
next time.

How are you configuring Eclipse?
You will find that a xmlbean project will generate its source in
target/generated-sources/xmlbeans and at least the version of
org.codehaus.mojo:xmlbeans-maven-plugin we are using requires us to
manually add this source directory via build-helper so that
maven-eclipse-plugin can include that directory automatically.

I do that like so

       ...
      <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>target/generated-sources/xmlbeans</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      ...
    </plugins>
  </build>

By default maven-eclipse-plugin will use project references.  So
module2 depends upon module1's project in Eclipse.
Because the classpath for module1 has not been correctly setup (i.e.
its missing target/generated-sources/xmlbeans) then module2 won't be
able to build correctly.
If module2 had been setup to use the jars in the repo instead, then
you would not be having this problem.
(I prefer Eclipse project references and not links to jars in the repo
for projects that I am working on)

Of course if you are not use maven-eclipse-plugin I dont know what the
problem is, but the cause would be similar.

Normally I manually fix the build path's in Eclipse to get things
working, and then backtrack to determine why this wasn't done
automatically for me.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message