You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by R....@akka.eu on 2010/10/08 15:45:46 UTC

[Dependencies] Build fails from parent pom but works from module pom

Hi guys !

I work on a portlet project so some dependencies are provided by the portal (ie hibernate, spring etc...).

My project has 2 modules  :
-parent
|_services
|_ui

Hibernate is a dependency from the services module. The services module is a dependency from the ui module. I use classes from Hibernate in the ui module (DetachedCriteria), so I expect the hibernate dependency to be known by the ui module.

Here is the weird thing :
- ui module build is successfull when executed from his pom file.
- ui module build fails with a "package org.hibernate[...] does not exist" error when executed from the parent pom file.

Indeed as I watch the output of the mvn dependency:tree command for both locations (parent & ui module), I don't get the same tree (hibernate dependency doesn't show in the ui tree generated from the parent pom).

My workaround is to re-call the hibernate dependency in the ui pom file, but in my opinion Maven should resolve this alone...

Any thoughts ?

Romain WILBERT


Re: [Dependencies] Build fails from parent pom but works from module pom

Posted by Ron Wheeler <rw...@artifact-software.com>.
  We are building a large portlet project (60+ maven projects) and have 
developed a pretty good methodology.
I have described it a few times in the forum.
It works well with Spring, Hibernate, MySQL, Jetspeed, CXF, and about 50 
other common libraries from Apache and others.

Ron

On 08/10/2010 9:45 AM, R.WILBERT@akka.eu wrote:
> Hi guys !
>
> I work on a portlet project so some dependencies are provided by the portal (ie hibernate, spring etc...).
>
> My project has 2 modules  :
> -parent
> |_services
> |_ui
>
> Hibernate is a dependency from the services module. The services module is a dependency from the ui module. I use classes from Hibernate in the ui module (DetachedCriteria), so I expect the hibernate dependency to be known by the ui module.
>
> Here is the weird thing :
> - ui module build is successfull when executed from his pom file.
> - ui module build fails with a "package org.hibernate[...] does not exist" error when executed from the parent pom file.
>
> Indeed as I watch the output of the mvn dependency:tree command for both locations (parent&  ui module), I don't get the same tree (hibernate dependency doesn't show in the ui tree generated from the parent pom).
>
> My workaround is to re-call the hibernate dependency in the ui pom file, but in my opinion Maven should resolve this alone...
>
> Any thoughts ?
>
> Romain WILBERT
>
>


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


Re: [Dependencies] Build fails from parent pom but works from module pom

Posted by Antonio Petrelli <an...@gmail.com>.
2010/10/8  <R....@akka.eu>:
> My project has 2 modules  :
> -parent
> |_services
> |_ui
>
> Hibernate is a dependency from the services module.

With which scope? IIRC only if you have "compile" or "runtime" it
becomes a transitive dependency.

Antonio

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


Re: [Dependencies] Build fails from parent pom but works from module pom

Posted by Zac Thompson <za...@gmail.com>.
On Fri, Oct 8, 2010 at 6:45 AM,  <R....@akka.eu> wrote:
> I work on a portlet project so some dependencies are provided by the portal (ie hibernate, spring etc...).
>
> My project has 2 modules  :
> -parent
> |_services
> |_ui
>
> Hibernate is a dependency from the services module. The services module is a dependency from the ui module. I use classes from Hibernate in the ui module (DetachedCriteria), so I expect the hibernate dependency to be known by the ui module.

My guess is that you are declaring the dependency as 'provided'.
That's probably the correct thing to do, but if you use Hibernate
classes from the ui module, then the ui module should also be
declaring a (provided) dependency on Hibernate.  You can use
dependency:analyze to expose these issues.

> Here is the weird thing :
> - ui module build is successfull when executed from his pom file.
> - ui module build fails with a "package org.hibernate[...] does not exist" error when executed from the parent pom file.

That's strange; generally if it works in isolation then it should work
when built from the parent.  Is this running 'mvn install' or some
other goal?  Which version of Maven are you using?

> Indeed as I watch the output of the mvn dependency:tree command for both locations (parent & ui module), I don't get the same tree (hibernate dependency doesn't show in the ui tree generated from the parent pom).

Have you tried dependency:tree -Dverbose=true?  This will show you
conflicts etc.

> My workaround is to re-call the hibernate dependency in the ui pom file, but in my opinion Maven should resolve this alone...

Agreed, but this is the right thing to do in this case anyway.

If you still want to troubleshoot it, you should post poms for the
parent and both modules, especially including any hibernate mentions.
You might also want to post the 'tree' information when running from
the parent and from the ui module directory.

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