You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by aappddeevv12 <aa...@verizon.net> on 2011/01/17 23:03:07 UTC

parent pom and child compile; child needs sibling classes

I have the following setup using Maven3 (or 2.2):

Parent-Pom (same directory level as Child1,2. Use relativePath for parent in
Child1, Child2)
Child1: ClassA, ClassB
Child2: ClassA_Entity.aj, ClassB_Entity.aj

So Child2 needs Child1 classes to augment with aspectj. I have all of the
aspectj components setup correctly (e.g. Child1 dependency is on the inpath,
etc.). Everything works fine if I run package or test in the parent
directory. Child2 sees the assembly from Child1 just as the docs suggest.

The docs also say that if I run mvn test (for example) in Child2, then
Child1 has to be in the repository because maven won't build Child1.

However, is there a setting that says, don't expect Child1 in the
repository, just use the target class files since its a sibling child? The
docs also say that if I run mvn test in the parent, Child2 will see the
target directory in Child1 and not have to have Child1 in the repository. So
its slightly different behavior depending on where you issues the test or
assembly command in the parent or child projects. That's fine, but for
various IDE reasons, I would like to have Child1 target classes directly
accessed whenever I run a maven command in Child2.

Is there a switch that says when I issue a mvn command in Child2 to use the
target classes in Child1 instead of forcing Child1 to have to be in the
repository?

I had envisioned 2-3 child projects each depending on a sibling or two that
augment the basic classes using aspectj. In this case, chaining helps me
with IDE development. ADJT in eclipse can do this, but when I use m2eclipse
and it runs maven under the hood on a full rebuild, maven forces the sibling
to be in the repository, which its not (and which incurs even more build
time to force it to be in the repository).

Is there another way to handle this that is a better pattern or approach?


-- 
View this message in context: http://maven.40175.n5.nabble.com/parent-pom-and-child-compile-child-needs-sibling-classes-tp3345200p3345200.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: parent pom and child compile; child needs sibling classes

Posted by aappddeevv12 <aa...@verizon.net>.
Thanks for the response. Based on your comments I looked into maven reactor.
It looks like in 2.2 and 3.0 some of the functionality has been exposed as
command line options directly. It does help project build subsets, so now I
understand how it works.

It does not help with the classpath resolution issue. m2eclipse seems to
know how to add projects in the eclipse workspace to a "project repository"
to resolve from but not core maven. Perhaps there is a plugin that allows
you to arbitrarily specify relative paths of folders for resolving classes
on the classpath for certain scopes e.g. test. I'll keep an eye out.
Meanwhile, I'll try to address my needs another way or understand if I am
trying to do something that is really not needed.
-- 
View this message in context: http://maven.40175.n5.nabble.com/parent-pom-and-child-compile-child-needs-sibling-classes-tp3345200p3345453.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: parent pom and child compile; child needs sibling classes

Posted by Wayne Fay <wa...@gmail.com>.
> However, is there a setting that says, don't expect Child1 in the
> repository, just use the target class files since its a sibling child? The

No.

> various IDE reasons, I would like to have Child1 target classes directly
> accessed whenever I run a maven command in Child2.

You can't.

> Is there a switch that says when I issue a mvn command in Child2 to use the
> target classes in Child1 instead of forcing Child1 to have to be in the
> repository?

No. Unless you are building from the parent, as you already stated.

> Is there another way to handle this that is a better pattern or approach?

The reactor plugin may be helpful, but I'm honestly unsure as I've
never formally used it as yet.
http://stackoverflow.com/questions/2050241/what-is-the-maven-reactor

Wayne

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