You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Franklin <af...@cmcrc.com> on 2007/01/12 03:58:28 UTC

Not a circular dependency...

I've got a situation where Maven is telling me I have a circular 
dependency that should be resolved.

Let's say I've got applicationArtifact which provides an interface which 
I want to consume at compile time in an artifact called pluginArtifact.  
When applicationArtifact is ready to be packaged, I want to include 
pluginArtifact in the libs as a runtime dependency.

ie.

<artifactId>applicationArtifact</artifactId>
<dependencies>
  <dependency>
    <artifactId>pluginArtifact</artifactId>
    <scope>runtime</scope>
  </dependency>
</dependencies>

<artifactId>pluginArtifact</artifactId>
<dependencies>
  <dependency>
    <artifactId>applicationArtifact</artifactId>
    <scope>compile</scope>  <!-- such that we can use the common 
interface -->
  </dependency>
</dependencies>


Maven won't compile the above as it cites a circular dependency. This 
should work because of the following valid order:

1) compile applicationArtifact (ignore pluginArtifact because it's 
scoped at Runtime)
2) compile pluginArtifact (include a compile time reference to 
applicationArtifact)
3) package applicationArtifact (which drags in pluginArtifact)


How should I solve this issue?

Andrew

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


Re: Not a circular dependency...

Posted by franz see <fr...@gmail.com>.
Good day to you, Andrew,

AFAIK, scopes are not considered when it comes to checking for circular
dependencies. If you think it should be, feel free to open an issue in [1]
under the Dependencies component.

Also, you may want to support a pre-package phase which could probably solve
your problem ( see the issue [2] and the thread [3] ).

With regards to the workaround - I don't know if there is any clean way of
doing it. But if you want, you can try and copy the runtime artifact into
the directory where your 3rd party plugin will look for the binaries it will
package, before the actual packaging.

Cheers,
Franz

[1] http://jira.codehaus.org/browse/MNG
[2] http://jira.codehaus.org/browse/MNG-2097
[3] http://www.nabble.com/forum/ViewPost.jtp?post=7667475&framed=y&skin=177


Andrew Franklin wrote:
> 
> Patrick,
> 
> I appreciate your suggestion, but unfortunately I want to use a 3rd 
> party plugin to generate a web-start application at the package goal.  
> The requirement of running this last goal prevents me from both using 
> assembly, and using ant-run extensions.
> 
> One solution I can potentially see if using ant-run scripts to generate 
> the web-start component, but that's getting pretty nasty. I was hoping 
> there'd be a cleaner solution.
> 
> Cheers,
> Andrew
> 
> 
> Patrick Schneider wrote:
>> Maybe you could try using the assembly plugin to assemble your final
>> package...  and use the assembly descriptor to specify which items should
>> be
>> included in it?  This should allow you to remove the pluginArtifact
>> dependency in your applicationArtifact pom.  Just a thought...
>>
>>
>> Patrick
>>
>> On 1/11/07, Andrew Franklin <af...@cmcrc.com> wrote:
>> >
>> > I've got a situation where Maven is telling me I have a circular
>> > dependency that should be resolved.
>> >
>> > Let's say I've got applicationArtifact which provides an interface
>> which
>> > I want to consume at compile time in an artifact called pluginArtifact.
>> > When applicationArtifact is ready to be packaged, I want to include
>> > pluginArtifact in the libs as a runtime dependency.
>> >
>> > ie.
>> >
>> > <artifactId>applicationArtifact</artifactId>
>> > <dependencies>
>> >   <dependency>
>> >     <artifactId>pluginArtifact</artifactId>
>> >     <scope>runtime</scope>
>> >   </dependency>
>> > </dependencies>
>> >
>> > <artifactId>pluginArtifact</artifactId>
>> > <dependencies>
>> >   <dependency>
>> >     <artifactId>applicationArtifact</artifactId>
>> >     <scope>compile</scope>  <!-- such that we can use the common
>> > interface -->
>> >   </dependency>
>> > </dependencies>
>> >
>> >
>> > Maven won't compile the above as it cites a circular dependency. This
>> > should work because of the following valid order:
>> >
>> > 1) compile applicationArtifact (ignore pluginArtifact because it's
>> > scoped at Runtime)
>> > 2) compile pluginArtifact (include a compile time reference to
>> > applicationArtifact)
>> > 3) package applicationArtifact (which drags in pluginArtifact)
>> >
>> >
>> > How should I solve this issue?
>> >
>> > Andrew
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: users-help@maven.apache.org
>> >
>> >
>>
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Not-a-circular-dependency...-tf2963744s177.html#a8292763
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: Not a circular dependency...

Posted by Patrick Schneider <ps...@gmail.com>.
Maybe you could try using the assembly plugin to assemble your final
package...  and use the assembly descriptor to specify which items should be
included in it?  This should allow you to remove the pluginArtifact
dependency in your applicationArtifact pom.  Just a thought...


Patrick

On 1/11/07, Andrew Franklin <af...@cmcrc.com> wrote:
>
> I've got a situation where Maven is telling me I have a circular
> dependency that should be resolved.
>
> Let's say I've got applicationArtifact which provides an interface which
> I want to consume at compile time in an artifact called pluginArtifact.
> When applicationArtifact is ready to be packaged, I want to include
> pluginArtifact in the libs as a runtime dependency.
>
> ie.
>
> <artifactId>applicationArtifact</artifactId>
> <dependencies>
>   <dependency>
>     <artifactId>pluginArtifact</artifactId>
>     <scope>runtime</scope>
>   </dependency>
> </dependencies>
>
> <artifactId>pluginArtifact</artifactId>
> <dependencies>
>   <dependency>
>     <artifactId>applicationArtifact</artifactId>
>     <scope>compile</scope>  <!-- such that we can use the common
> interface -->
>   </dependency>
> </dependencies>
>
>
> Maven won't compile the above as it cites a circular dependency. This
> should work because of the following valid order:
>
> 1) compile applicationArtifact (ignore pluginArtifact because it's
> scoped at Runtime)
> 2) compile pluginArtifact (include a compile time reference to
> applicationArtifact)
> 3) package applicationArtifact (which drags in pluginArtifact)
>
>
> How should I solve this issue?
>
> Andrew
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>