You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Alan D. Cabrera" <li...@toolazydogs.com> on 2010/10/01 18:56:34 UTC

Dependency policies

Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?  

For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.


Regards,
Alan


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


Re: Dependency policies

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Oct 1, 2010 at 12:56 PM, Alan D. Cabrera <li...@toolazydogs.com> wrote:
> Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?
>
> For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.

Possibly overkill for your needs, but SonarJ allows you to define and
enforce architecture rules.
http://www.hello2morrow.com/products/sonarj  [not free, though it
looks like there is a community edition]

-- 
Wendy

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


Re: Dependency policies

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
Thinking out loud...

The rules would have to be shared amongst thousands of projects.  I guess I could put the plugin in some shared parent POM.

The groupId/artifact naming convention for categories will be tough.  I have no control over that.

What would be cool is if we could add additional information to the POM but in the plugin's own namespace, say foo.

<project>
    ...

    <foo:category>api</foo:category>
    ...
</project>

and the plugin could pull that info in some how and perform its checks.  This would work for me because I would not have to change the coordinates of the jars but I could add a bit of information to the artifact's POM.


Regards,
Alan

On Oct 1, 2010, at 12:32 PM, David Jencks wrote:

> maybe you could enhance that rule to do regexp matching on each maven coordinate component and implement your category concept using a naming convention?
> 
> david jencks
> 
> On Oct 1, 2010, at 10:51 AM, Alan D. Cabrera wrote:
> 
>> It's close but not exactly what I need.  I don't want to maintain rules on artifacts.  I want to maintain restrictions between categories of artifacts.
>> 
>> 
>> Regards,
>> Alan
>> 
>> On Oct 1, 2010, at 10:22 AM, Rex Hoffman wrote:
>> 
>>> I haven't used it: but this, and profiles, should do the trick.
>>> http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
>>> 
>>> I'm just trying to get some contributions in to maven (other enforcer
>>> rules) but still feel the need to say you probably should have asked
>>> this on the user mailing list.
>>> 
>>> Rex
>>> 
>>> On Fri, Oct 1, 2010 at 9:56 AM, Alan D. Cabrera <li...@toolazydogs.com> wrote:
>>>> Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?
>>>> 
>>>> For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.
>>>> 
>>>> 
>>>> Regards,
>>>> Alan
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Rex Hoffman
>>> 
>>> (415) 273-9438
>>> 415-2REXGET
>>> http://www.e-hoffman.org
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


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


Re: Dependency policies

Posted by David Jencks <da...@yahoo.com>.
maybe you could enhance that rule to do regexp matching on each maven coordinate component and implement your category concept using a naming convention?

david jencks

On Oct 1, 2010, at 10:51 AM, Alan D. Cabrera wrote:

> It's close but not exactly what I need.  I don't want to maintain rules on artifacts.  I want to maintain restrictions between categories of artifacts.
> 
> 
> Regards,
> Alan
> 
> On Oct 1, 2010, at 10:22 AM, Rex Hoffman wrote:
> 
>> I haven't used it: but this, and profiles, should do the trick.
>> http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
>> 
>> I'm just trying to get some contributions in to maven (other enforcer
>> rules) but still feel the need to say you probably should have asked
>> this on the user mailing list.
>> 
>> Rex
>> 
>> On Fri, Oct 1, 2010 at 9:56 AM, Alan D. Cabrera <li...@toolazydogs.com> wrote:
>>> Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?
>>> 
>>> For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.
>>> 
>>> 
>>> Regards,
>>> Alan
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Rex Hoffman
>> 
>> (415) 273-9438
>> 415-2REXGET
>> http://www.e-hoffman.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


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


Re: Dependency policies

Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
It's close but not exactly what I need.  I don't want to maintain rules on artifacts.  I want to maintain restrictions between categories of artifacts.


Regards,
Alan

On Oct 1, 2010, at 10:22 AM, Rex Hoffman wrote:

> I haven't used it: but this, and profiles, should do the trick.
> http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html
> 
> I'm just trying to get some contributions in to maven (other enforcer
> rules) but still feel the need to say you probably should have asked
> this on the user mailing list.
> 
> Rex
> 
> On Fri, Oct 1, 2010 at 9:56 AM, Alan D. Cabrera <li...@toolazydogs.com> wrote:
>> Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?
>> 
>> For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.
>> 
>> 
>> Regards,
>> Alan
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
>> 
> 
> 
> 
> -- 
> Rex Hoffman
> 
> (415) 273-9438
> 415-2REXGET
> http://www.e-hoffman.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


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


Re: Dependency policies

Posted by Rex Hoffman <re...@e-hoffman.org>.
I haven't used it: but this, and profiles, should do the trick.
http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html

I'm just trying to get some contributions in to maven (other enforcer
rules) but still feel the need to say you probably should have asked
this on the user mailing list.

Rex

On Fri, Oct 1, 2010 at 9:56 AM, Alan D. Cabrera <li...@toolazydogs.com> wrote:
> Is there some way to categorize jars and restrict the dependencies between categories of those jars?  At least maybe reports dependency violations?
>
> For example let's say I have two categories, api and impl.  Impl can depend on Api but not others' impl.  Api can rely on Api.  When I perform a build it would be nice if the build failed or at least an warning is reported.
>
>
> Regards,
> Alan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>



-- 
Rex Hoffman

(415) 273-9438
415-2REXGET
http://www.e-hoffman.org

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