You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Carsten Ziegeler <cz...@apache.org> on 2011/11/07 19:05:39 UTC

Meta information about dependencies in a pom?

Hi,

in Apache Sling we have the need to add additional information to a
dependency in a pom, basically it's just an xml attribute, like:

<dependency sling:startlevel="1">

Now, with a little bit of hacking we could get this working in our
plugin be parsing or converting the pom xml file ourselves (we don't
need pom inheritance or transitive handling of this additional
information)

The question now is, what do you think about it? Is there something
planned in that direction? If we would do it, do you think that we
might get into trouble with future versions of maven?

Regards
Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@tesla.io>.
On Nov 8, 2011, at 1:30 PM, Jörg Schaible wrote:

> 
> If the support is added for definitions in the local POM only, I really bet 
> that the first question on the list will be "I want to declare this 
> attribute always with that dependency - how can I do it?" ;-)
> 

Ultimately when/if it's in the POM that will be the case.

> However, I am in the same boat with David. We have a also a plugin that 
> would be a lot easier to configure with such attributes.
> 

This is the primary use case for dependency properties. So that plugins the produce created can act on these properties.

> Cheers,
> Jörg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

the course of true love never did run smooth ...

 -- Shakespeare





Re: Meta information about dependencies in a pom?

Posted by Jörg Schaible <jo...@gmx.de>.
Jason van Zyl wrote:

> 
> On Nov 8, 2011, at 12:41 PM, Jörg Schaible wrote:
> 
>> Jason van Zyl wrote:
>> 
>>> To clarify, technically easy to implement. If we did this with
>>> attributes we don't have to deal with POM changes, and if we say this is
>>> truly for producers then the attributes getting stripped out on deploy
>>> would be fine. The this serves the concerns of producers, and really has
>>> zero impact on consumers.
>> 
>> Why are my dependency attributes available when I inherit them from my
>> parent POM in the parent directory, but not if the parent POM is
>> downloaded from the repository?
> 
> Because they are intended to only be usable by the actual build producing
> the output. Beyond that there is no use for these attributes as we have
> scope their use here.
> 
> That is not to say they cannot be made available. As they were implemented
> in Maven 1.x it was part of the POM so they were available. How I have
> described it, and as you have correctly interpreted it, allows us to do it
> without POM changes so that it can be done quickly.
> 
>> Can my dependency attributes defined in the dependency
>> management section? Can I overwrite an inherited dependency attribute
>> with a new value?
> 
> I don't think this is how it should work. It is strictly for build-only
> use.

If the support is added for definitions in the local POM only, I really bet 
that the first question on the list will be "I want to declare this 
attribute always with that dependency - how can I do it?" ;-)

However, I am in the same boat with David. We have a also a plugin that 
would be a lot easier to configure with such attributes.

Cheers,
Jörg


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


Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@tesla.io>.
On Nov 8, 2011, at 12:41 PM, Jörg Schaible wrote:

> Jason van Zyl wrote:
> 
>> To clarify, technically easy to implement. If we did this with attributes
>> we don't have to deal with POM changes, and if we say this is truly for
>> producers then the attributes getting stripped out on deploy would be
>> fine. The this serves the concerns of producers, and really has zero
>> impact on consumers.
> 
> Why are my dependency attributes available when I inherit them from my 
> parent POM in the parent directory, but not if the parent POM is downloaded 
> from the repository?

Because they are intended to only be usable by the actual build producing the output. Beyond that there is no use for these attributes as we have scope their use here.

That is not to say they cannot be made available. As they were implemented in Maven 1.x it was part of the POM so they were available. How I have described it, and as you have correctly interpreted it, allows us to do it without POM changes so that it can be done quickly.

> Can my dependency attributes defined in the dependency 
> management section? Can I overwrite an inherited dependency attribute with a 
> new value?

I don't think this is how it should work. It is strictly for build-only use.

> 
> Can of worms.
> 
> Just my 2c,
> Jörg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

We know what we are, but know not what we may be.

  -- Shakespeare





Re: Meta information about dependencies in a pom?

Posted by Jörg Schaible <jo...@gmx.de>.
Jason van Zyl wrote:

> To clarify, technically easy to implement. If we did this with attributes
> we don't have to deal with POM changes, and if we say this is truly for
> producers then the attributes getting stripped out on deploy would be
> fine. The this serves the concerns of producers, and really has zero
> impact on consumers.

Why are my dependency attributes available when I inherit them from my 
parent POM in the parent directory, but not if the parent POM is downloaded 
from the repository? Can my dependency attributes defined in the dependency 
management section? Can I overwrite an inherited dependency attribute with a 
new value?

Can of worms.

Just my 2c,
Jörg


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


Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@maven.org>.
To clarify, technically easy to implement. If we did this with attributes we don't have to deal with POM changes, and if we say this is truly for producers then the attributes getting stripped out on deploy would be fine. The this serves the concerns of producers, and really has zero impact on consumers.

On Nov 8, 2011, at 12:01 PM, Jason van Zyl wrote:

> Yes, it is something that would be relatively easy to implement, and would be valuable. Ultimately I think it was a mistake to remove this capability. It helps the producers and has no affect on consumers. No brainer.
> 
> On Nov 8, 2011, at 10:47 AM, Carsten Ziegeler wrote:
> 
>> 2011/11/8 David Jencks <da...@yahoo.com>:
>>> I've run into this problem in 3 or 4 situations and the only practical solution is to individually list the dependencies with the extra info in the plugin configurations.  I don't really understand the mindset that only the information needed for some bits of well-known maven can be associated with dependencies, and all other uses should just duplicate large swathes of maven configuration to be able to add a couple bits of info per dependency.   My impression is that aether takes a more inclusive view of dependency properties.
>> 
>> 
>> So is this something we could implement in Maven (easily)?
>> 
>> Carsten
>> 
>>> 
>>> thanks
>>> david jencks
>>> 
>>> On Nov 8, 2011, at 9:00 AM, Brett Porter wrote:
>>> 
>>>> 
>>>> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>>>> 
>>>>> Yes, we were using that approach for years now and it turned out to be
>>>>> too error prone as you have to keep the plugin configuration and the
>>>>> dependency list in sync. It doesn't sound like a hard task first, but
>>>>> in our case it caused trouble many times. That's why we would like to
>>>>> have a single point of information.
>>>> 
>>>> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?
>>>> 
>>>> How would you handle transitive dependencies?
>>>> 
>>>> - Brett
>>>> 
>>>> --
>>>> Brett Porter
>>>> brett@apache.org
>>>> http://brettporter.wordpress.com/
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Carsten Ziegeler
>> cziegeler@apache.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
> 
> A language that doesn’t affect the way you think about programming is not worth knowing. 
> 
> -— Alan Perlis
> 
> 
> 
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

A language that doesn’t affect the way you think about programming is not worth knowing. 
 
 -— Alan Perlis






Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

We know what we are, but know not what we may be.

  -- Shakespeare





Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@tesla.io>.
To clarify, technically easy to implement. If we did this with attributes we don't have to deal with POM changes, and if we say this is truly for producers then the attributes getting stripped out on deploy would be fine. The this serves the concerns of producers, and really has zero impact on consumers.

On Nov 8, 2011, at 12:01 PM, Jason van Zyl wrote:

> Yes, it is something that would be relatively easy to implement, and would be valuable. Ultimately I think it was a mistake to remove this capability. It helps the producers and has no affect on consumers. No brainer.
> 
> On Nov 8, 2011, at 10:47 AM, Carsten Ziegeler wrote:
> 
>> 2011/11/8 David Jencks <da...@yahoo.com>:
>>> I've run into this problem in 3 or 4 situations and the only practical solution is to individually list the dependencies with the extra info in the plugin configurations.  I don't really understand the mindset that only the information needed for some bits of well-known maven can be associated with dependencies, and all other uses should just duplicate large swathes of maven configuration to be able to add a couple bits of info per dependency.   My impression is that aether takes a more inclusive view of dependency properties.
>> 
>> 
>> So is this something we could implement in Maven (easily)?
>> 
>> Carsten
>> 
>>> 
>>> thanks
>>> david jencks
>>> 
>>> On Nov 8, 2011, at 9:00 AM, Brett Porter wrote:
>>> 
>>>> 
>>>> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>>>> 
>>>>> Yes, we were using that approach for years now and it turned out to be
>>>>> too error prone as you have to keep the plugin configuration and the
>>>>> dependency list in sync. It doesn't sound like a hard task first, but
>>>>> in our case it caused trouble many times. That's why we would like to
>>>>> have a single point of information.
>>>> 
>>>> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?
>>>> 
>>>> How would you handle transitive dependencies?
>>>> 
>>>> - Brett
>>>> 
>>>> --
>>>> Brett Porter
>>>> brett@apache.org
>>>> http://brettporter.wordpress.com/
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 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
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Carsten Ziegeler
>> cziegeler@apache.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
> 
> A language that doesn’t affect the way you think about programming is not worth knowing. 
> 
> -— Alan Perlis
> 
> 
> 
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

A language that doesn’t affect the way you think about programming is not worth knowing. 
 
 -— Alan Perlis





Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@maven.org>.
Yes, it is something that would be relatively easy to implement, and would be valuable. Ultimately I think it was a mistake to remove this capability. It helps the producers and has no affect on consumers. No brainer.

On Nov 8, 2011, at 10:47 AM, Carsten Ziegeler wrote:

> 2011/11/8 David Jencks <da...@yahoo.com>:
>> I've run into this problem in 3 or 4 situations and the only practical solution is to individually list the dependencies with the extra info in the plugin configurations.  I don't really understand the mindset that only the information needed for some bits of well-known maven can be associated with dependencies, and all other uses should just duplicate large swathes of maven configuration to be able to add a couple bits of info per dependency.   My impression is that aether takes a more inclusive view of dependency properties.
> 
> 
> So is this something we could implement in Maven (easily)?
> 
> Carsten
> 
>> 
>> thanks
>> david jencks
>> 
>> On Nov 8, 2011, at 9:00 AM, Brett Porter wrote:
>> 
>>> 
>>> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>>> 
>>>> Yes, we were using that approach for years now and it turned out to be
>>>> too error prone as you have to keep the plugin configuration and the
>>>> dependency list in sync. It doesn't sound like a hard task first, but
>>>> in our case it caused trouble many times. That's why we would like to
>>>> have a single point of information.
>>> 
>>> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?
>>> 
>>> How would you handle transitive dependencies?
>>> 
>>> - Brett
>>> 
>>> --
>>> Brett Porter
>>> brett@apache.org
>>> http://brettporter.wordpress.com/
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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
>> 
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

A language that doesn’t affect the way you think about programming is not worth knowing. 
 
 -— Alan Perlis





Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
2011/11/8 David Jencks <da...@yahoo.com>:
> I've run into this problem in 3 or 4 situations and the only practical solution is to individually list the dependencies with the extra info in the plugin configurations.  I don't really understand the mindset that only the information needed for some bits of well-known maven can be associated with dependencies, and all other uses should just duplicate large swathes of maven configuration to be able to add a couple bits of info per dependency.   My impression is that aether takes a more inclusive view of dependency properties.


So is this something we could implement in Maven (easily)?

Carsten

>
> thanks
> david jencks
>
> On Nov 8, 2011, at 9:00 AM, Brett Porter wrote:
>
>>
>> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>>
>>> Yes, we were using that approach for years now and it turned out to be
>>> too error prone as you have to keep the plugin configuration and the
>>> dependency list in sync. It doesn't sound like a hard task first, but
>>> in our case it caused trouble many times. That's why we would like to
>>> have a single point of information.
>>
>> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?
>>
>> How would you handle transitive dependencies?
>>
>> - Brett
>>
>> --
>> Brett Porter
>> brett@apache.org
>> http://brettporter.wordpress.com/
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by David Jencks <da...@yahoo.com>.
I've run into this problem in 3 or 4 situations and the only practical solution is to individually list the dependencies with the extra info in the plugin configurations.  I don't really understand the mindset that only the information needed for some bits of well-known maven can be associated with dependencies, and all other uses should just duplicate large swathes of maven configuration to be able to add a couple bits of info per dependency.   My impression is that aether takes a more inclusive view of dependency properties.

thanks
david jencks

On Nov 8, 2011, at 9:00 AM, Brett Porter wrote:

> 
> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
> 
>> Yes, we were using that approach for years now and it turned out to be
>> too error prone as you have to keep the plugin configuration and the
>> dependency list in sync. It doesn't sound like a hard task first, but
>> in our case it caused trouble many times. That's why we would like to
>> have a single point of information.
> 
> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?
> 
> How would you handle transitive dependencies?
> 
> - Brett
> 
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> 
> 
> ---------------------------------------------------------------------
> 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: Meta information about dependencies in a pom?

Posted by Nigel Magnay <ni...@gmail.com>.
Well, the problem currently is if you define a pom that declares a number
of dependencies (e.g: the ones you need for the flex framework), and some
of these have custom scopes (e.g: RSL or external), those scopes are
stripped when you include that pom in your project. (IIRC, anything custom
just gets converted into 'runtime')

e.g:
https://issues.sonatype.org/browse/FLEXMOJOS-153

I asked about it last month:
http://maven.40175.n5.nabble.com/custom-scopes-eaten-when-dependency-is-transitive-td4888586.html

That means that unfortunately I'm having to specify every one of about 15
dependencies manually in every project (in the exact correct order, but
that's a different non-maven issue! :-) )

Sure, being able to provide default, or regex-specified values to groups of
artifacts can be nice - but it's not always easy to get right, an sometimes
the information is granular enough that you want to be able to specify it
for each individual artifact. For flex, if the dependency is an RSL, for
each one I can specify not just the application domain, but the deployment
path, policy file URL(s) and force-load attributes. It's just feels more
natural (to me) to keep that with the dependency statement rather than
referenced via the coordinate in some other place in the POM.



On Tue, Nov 8, 2011 at 5:00 PM, Brett Porter <br...@apache.org> wrote:

>
> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>
> > Yes, we were using that approach for years now and it turned out to be
> > too error prone as you have to keep the plugin configuration and the
> > dependency list in sync. It doesn't sound like a hard task first, but
> > in our case it caused trouble many times. That's why we would like to
> > have a single point of information.
>
> So, wildcards or excludes lists don't help with the sync task? There's no
> convention that can be applied (e.g. all dependencies of a certain type, or
> the same group ID as the project)?
>
> How would you handle transitive dependencies?
>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
2011/11/8 Brett Porter <br...@apache.org>:
>
> On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:
>
>> Yes, we were using that approach for years now and it turned out to be
>> too error prone as you have to keep the plugin configuration and the
>> dependency list in sync. It doesn't sound like a hard task first, but
>> in our case it caused trouble many times. That's why we would like to
>> have a single point of information.
>
> So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?

No, unfortunately not - we have a large list of dependencies with
different group ids, all having the same type, so while some share the
same group id, in the end we have to list each and every artidact id.

>
> How would you handle transitive dependencies?
We don't consider transitive dependencies, so we just include stuff
which is really listed in this pom.

In the end this is the application assembly which builds the final
distribution based on modules. So we list all the modules as direct
dependencies to avoid any surprises through transitive dependencies.
And we just need additional information on a per module base. This
info must also be defined outside of the module, so we can't just
include it in the module artifact as the info might vary from app to
app and third party modules are involved.

Regards
Carsten



>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by Brett Porter <br...@apache.org>.
On 08/11/2011, at 8:15 AM, Carsten Ziegeler wrote:

> Yes, we were using that approach for years now and it turned out to be
> too error prone as you have to keep the plugin configuration and the
> dependency list in sync. It doesn't sound like a hard task first, but
> in our case it caused trouble many times. That's why we would like to
> have a single point of information.

So, wildcards or excludes lists don't help with the sync task? There's no convention that can be applied (e.g. all dependencies of a certain type, or the same group ID as the project)?

How would you handle transitive dependencies?

- Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/


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


Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
Thanks everyone for the help, Justin has implemented the lifecycle
participant and it seems to solve our problems pretty well.

Regards
Carsten

2011/11/9 Jason van Zyl <ja...@tesla.io>:
> Yes that's why I said to pull them out. You won't be successful in using JSR330. It only works in Tesla, most of which will be integrated back into Maven. Just haven't had time to post to the dev list yet. JSR330 and @Injectable SLF4J loggers are but a few of a things possible with code that exists the Tesla repo.
>
> But it would be easy enough to build that out as a helper where someone just needs to define the source of their GAs they want to contribute and let the helper take care of the rest.
>
> On Nov 9, 2011, at 7:57 AM, Jesse Glick wrote:
>
>> On 11/09/2011 12:00 AM, Jason van Zyl wrote:
>>>> today we learned about the AbstractMavenLifecycleParticipant
>>>
>>> Here's an example of how it works for matching the dependencies specified from a 3rd party source to the reactor.
>>> [...]
>>> It's using JSR330, but you can pull those out and use Plexus annotations if you need it to work in the short term.
>>
>> A standalone example I just got to work: create a jar-packaging project with
>>
>> @Component(role=AbstractMavenLifecycleParticipant.class)
>> public class WhateverNameYouLike extends AbstractMavenLifecycleParticipant {
>>    @Requirement private Logger log;
>>    @Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
>>        for (MavenProject p : session.getProjects()) {
>>            log.info("tweaking " + p);
>>            Dependency d = new Dependency();
>>            d.setGroupId("org.apache.commons");
>>            d.setArtifactId("commons-io");
>>            d.setVersion("1.3.2");
>>            p.getDependencies().add(d);
>>        }
>>    }
>> }
>>
>> built with
>>
>> <build>
>>    <plugins>
>>        <plugin>
>>            <groupId>org.codehaus.plexus</groupId>
>>            <artifactId>plexus-component-metadata</artifactId>
>>            <version>1.5.5</version>
>>            <executions>
>>                <execution>
>>                    <goals>
>>                        <goal>generate-metadata</goal>
>>                    </goals>
>>                    <id>generate-metadata</id>
>>                </execution>
>>            </executions>
>>        </plugin>
>>    </plugins>
>> </build>
>> <dependencies>
>>    <dependency>
>>        <groupId>org.apache.maven</groupId>
>>        <artifactId>maven-core</artifactId>
>>        <version>3.0.3</version>
>>    </dependency>
>> </dependencies>
>>
>> Now create a quickstart project and edit the main method to say:
>>
>> System.out.println(org.apache.commons.io.EndianUtils.swapInteger(1));
>>
>> Once you tell it
>>
>> <build>
>>    <extensions>
>>        <extension>
>>            ...coordinates as for first project...
>>        </extension>
>>    </extensions>
>> </build>
>>
>> then it will compile (under 3.0.3) despite not itself declaring a dep on commons-io.
>>
>> BTW I was not successful in using @javax.inject.Singleton in place of @Component.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
>
> What matters is not ideas, but the people who have them. Good people can fix bad ideas, but good ideas can't save bad people.
>
>  -- Paul Graham
>
>
>
>
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@tesla.io>.
Yes that's why I said to pull them out. You won't be successful in using JSR330. It only works in Tesla, most of which will be integrated back into Maven. Just haven't had time to post to the dev list yet. JSR330 and @Injectable SLF4J loggers are but a few of a things possible with code that exists the Tesla repo.

But it would be easy enough to build that out as a helper where someone just needs to define the source of their GAs they want to contribute and let the helper take care of the rest.

On Nov 9, 2011, at 7:57 AM, Jesse Glick wrote:

> On 11/09/2011 12:00 AM, Jason van Zyl wrote:
>>> today we learned about the AbstractMavenLifecycleParticipant
>> 
>> Here's an example of how it works for matching the dependencies specified from a 3rd party source to the reactor.
>> [...]
>> It's using JSR330, but you can pull those out and use Plexus annotations if you need it to work in the short term.
> 
> A standalone example I just got to work: create a jar-packaging project with
> 
> @Component(role=AbstractMavenLifecycleParticipant.class)
> public class WhateverNameYouLike extends AbstractMavenLifecycleParticipant {
>    @Requirement private Logger log;
>    @Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
>        for (MavenProject p : session.getProjects()) {
>            log.info("tweaking " + p);
>            Dependency d = new Dependency();
>            d.setGroupId("org.apache.commons");
>            d.setArtifactId("commons-io");
>            d.setVersion("1.3.2");
>            p.getDependencies().add(d);
>        }
>    }
> }
> 
> built with
> 
> <build>
>    <plugins>
>        <plugin>
>            <groupId>org.codehaus.plexus</groupId>
>            <artifactId>plexus-component-metadata</artifactId>
>            <version>1.5.5</version>
>            <executions>
>                <execution>
>                    <goals>
>                        <goal>generate-metadata</goal>
>                    </goals>
>                    <id>generate-metadata</id>
>                </execution>
>            </executions>
>        </plugin>
>    </plugins>
> </build>
> <dependencies>
>    <dependency>
>        <groupId>org.apache.maven</groupId>
>        <artifactId>maven-core</artifactId>
>        <version>3.0.3</version>
>    </dependency>
> </dependencies>
> 
> Now create a quickstart project and edit the main method to say:
> 
> System.out.println(org.apache.commons.io.EndianUtils.swapInteger(1));
> 
> Once you tell it
> 
> <build>
>    <extensions>
>        <extension>
>            ...coordinates as for first project...
>        </extension>
>    </extensions>
> </build>
> 
> then it will compile (under 3.0.3) despite not itself declaring a dep on commons-io.
> 
> BTW I was not successful in using @javax.inject.Singleton in place of @Component.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

What matters is not ideas, but the people who have them. Good people can fix bad ideas, but good ideas can't save bad people. 

 -- Paul Graham





Re: Meta information about dependencies in a pom?

Posted by Jesse Glick <je...@oracle.com>.
On 11/09/2011 12:00 AM, Jason van Zyl wrote:
>> today we learned about the AbstractMavenLifecycleParticipant
>
> Here's an example of how it works for matching the dependencies specified from a 3rd party source to the reactor.
> [...]
> It's using JSR330, but you can pull those out and use Plexus annotations if you need it to work in the short term.

A standalone example I just got to work: create a jar-packaging project with

@Component(role=AbstractMavenLifecycleParticipant.class)
public class WhateverNameYouLike extends AbstractMavenLifecycleParticipant {
     @Requirement private Logger log;
     @Override public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
         for (MavenProject p : session.getProjects()) {
             log.info("tweaking " + p);
             Dependency d = new Dependency();
             d.setGroupId("org.apache.commons");
             d.setArtifactId("commons-io");
             d.setVersion("1.3.2");
             p.getDependencies().add(d);
         }
     }
}

built with

<build>
     <plugins>
         <plugin>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-component-metadata</artifactId>
             <version>1.5.5</version>
             <executions>
                 <execution>
                     <goals>
                         <goal>generate-metadata</goal>
                     </goals>
                     <id>generate-metadata</id>
                 </execution>
             </executions>
         </plugin>
     </plugins>
</build>
<dependencies>
     <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-core</artifactId>
         <version>3.0.3</version>
     </dependency>
</dependencies>

Now create a quickstart project and edit the main method to say:

System.out.println(org.apache.commons.io.EndianUtils.swapInteger(1));

Once you tell it

<build>
     <extensions>
         <extension>
             ...coordinates as for first project...
         </extension>
     </extensions>
</build>

then it will compile (under 3.0.3) despite not itself declaring a dep on commons-io.

BTW I was not successful in using @javax.inject.Singleton in place of @Component.


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


Re: Meta information about dependencies in a pom?

Posted by Jason van Zyl <ja...@tesla.io>.
On Nov 8, 2011, at 8:00 PM, Carsten Ziegeler wrote:

> 2011/11/8 Guo Du <mr...@duguo.org>:
>>> too error prone as you have to keep the plugin configuration and the
>>> dependency list in sync. It doesn't sound like a hard task first, but
>> What about only configure the dependency list with additional field as
>> plugin configuration such as:
>> <configuration>
>> <bundles>
>> <bundle>
>> <groupId>foo</groupId>
>> <artifactId>bar</artifactId>
>> <version>x.y.z</version>
>> <startLevel>1</startLevel>
>> </bundle>
>> </bundles>
>> </configuration>
>> 
>> 
> Yes, that's basically a variant of what we came up with, but in this
> case the dependencies are not considered when maven is calculating a
> build order for a multi project build, so you end up with a "wrong"
> order when you are using snapshot dependencies. We had cases where the
> snapshot dep was built after the assembly causing an old snapshop to
> end up in the application.
> And other plugins like the versions plugin don't see this either.
> 
> But today we learned about the AbstractMavenLifecycleParticipant which
> hopefully allows us to use above configuration without the above
> problems.

Here's an example of how it works for matching the dependencies specified from a 3rd party source to the reactor.

https://github.com/etesla/proviso/tree/master/tesla-proviso-plugin/src/main/java/org/eclipse/tesla/plugins/proviso

It's using JSR330, but you can pull those out and use Plexus annotations if you need it to work in the short term.

> 
> Regards
> Carsten
> 
>> -Guo
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>> 
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------






Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
2011/11/8 Guo Du <mr...@duguo.org>:
>> too error prone as you have to keep the plugin configuration and the
>> dependency list in sync. It doesn't sound like a hard task first, but
> What about only configure the dependency list with additional field as
> plugin configuration such as:
> <configuration>
> <bundles>
> <bundle>
> <groupId>foo</groupId>
> <artifactId>bar</artifactId>
> <version>x.y.z</version>
> <startLevel>1</startLevel>
> </bundle>
> </bundles>
> </configuration>
>
>
Yes, that's basically a variant of what we came up with, but in this
case the dependencies are not considered when maven is calculating a
build order for a multi project build, so you end up with a "wrong"
order when you are using snapshot dependencies. We had cases where the
snapshot dep was built after the assembly causing an old snapshop to
end up in the application.
And other plugins like the versions plugin don't see this either.

But today we learned about the AbstractMavenLifecycleParticipant which
hopefully allows us to use above configuration without the above
problems.

Regards
Carsten

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



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by Guo Du <mr...@duguo.org>.
> too error prone as you have to keep the plugin configuration and the
> dependency list in sync. It doesn't sound like a hard task first, but
What about only configure the dependency list with additional field as
plugin configuration such as:
<configuration>
<bundles>
<bundle>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>x.y.z</version>
<startLevel>1</startLevel>
</bundle>
</bundles>
</configuration>


-Guo

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


Re: Meta information about dependencies in a pom?

Posted by Nigel Magnay <ni...@gmail.com>.
>
>
>
> Sorry, but it seems to me that it was simply a wrong approach to define own
> scopes. You run Maven in an undefined state and moan about it's undefined
> behavior.
>
> And the author of the flex plugin has tried, from observation, several
times, to get an answer from the maven-dev community about how these things
are supposed to be done if not with custom scopes, and every time seemingly
come up short.

Believing that the set of scopes that are adequate for describing Java Jar
dependencies are sufficient for languages other than Java seems quite
parochial behaviour.

Re: Meta information about dependencies in a pom?

Posted by Jörg Schaible <jo...@gmx.de>.
Nigel Magnay wrote:

> Yes. It's horrible. It occurs in other places too -- for example, in
> environments such as flex, you can declare a dependency with more scopes
> than java (merged, internal, external, rsl or caching). If it's an RSL,
> then you may choose one of about 4 'application domains' that control how
> it will be shared.
> 
> The scope bit sort of works (maven moans about it, and claims it's all
> unsupported

what's unclear about this bit then?

> , and transitive dependencies declared with nonstandard scopes
> don't work properly). The application domains - well, you're left
> duplicating almost all of the dependency information somewhere else in the
> POM. Which, as you say, is tedious, and gets out of sync.
> 
> I ended up writing a 'pom pre-processor xslt' that allowed me to include
> elements in exactly the way you're describing to at least maintain some
> kind DRY sanity. It's one of the thinks I look at gradle for, and wonder
> if that might be a better choice.

Sorry, but it seems to me that it was simply a wrong approach to define own 
scopes. You run Maven in an undefined state and moan about it's undefined 
behavior.

Jörg



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


Re: Meta information about dependencies in a pom?

Posted by Nigel Magnay <ni...@gmail.com>.
Yes. It's horrible. It occurs in other places too -- for example, in
environments such as flex, you can declare a dependency with more scopes
than java (merged, internal, external, rsl or caching). If it's an RSL,
then you may choose one of about 4 'application domains' that control how
it will be shared.

The scope bit sort of works (maven moans about it, and claims it's all
unsupported, and transitive dependencies declared with nonstandard scopes
don't work properly). The application domains - well, you're left
duplicating almost all of the dependency information somewhere else in the
POM. Which, as you say, is tedious, and gets out of sync.

I ended up writing a 'pom pre-processor xslt' that allowed me to include
elements in exactly the way you're describing to at least maintain some
kind DRY sanity. It's one of the thinks I look at gradle for, and wonder if
that might be a better choice.

On Tue, Nov 8, 2011 at 4:15 PM, Carsten Ziegeler <cz...@apache.org>wrote:

> Yes, we were using that approach for years now and it turned out to be
> too error prone as you have to keep the plugin configuration and the
> dependency list in sync. It doesn't sound like a hard task first, but
> in our case it caused trouble many times. That's why we would like to
> have a single point of information.
>
> Regards
> Carsten
>
> 2011/11/7 Brett Porter <br...@apache.org>:
> > The typical pattern used for this is an artefact filter applied to the
> configuration of the plugin, rather than information on the dependencies
> (like what the dependency plugin goals use). That was a feature of Maven 1
> that we rejected upfront.
> >
> > In my experience, it's actually less verbose since you typically include
> or exclude just a handful, or can use wildcards, rather than having to put
> a property of each dependency.
> >
> > - Brett
> >
> > On 07/11/2011, at 11:55 AM, Carsten Ziegeler wrote:
> >
> >> Maybe a little bit more information :) We need this information just
> >> for the build of the project containing this information. It's read by
> >> a custom plugin. So even if the information would not end up in the
> >> maven repository, we're fine.
> >>
> >> Carsten
> >>
> >> 2011/11/7 Carsten Ziegeler <cz...@apache.org>:
> >>> Hi,
> >>>
> >>> in Apache Sling we have the need to add additional information to a
> >>> dependency in a pom, basically it's just an xml attribute, like:
> >>>
> >>> <dependency sling:startlevel="1">
> >>>
> >>> Now, with a little bit of hacking we could get this working in our
> >>> plugin be parsing or converting the pom xml file ourselves (we don't
> >>> need pom inheritance or transitive handling of this additional
> >>> information)
> >>>
> >>> The question now is, what do you think about it? Is there something
> >>> planned in that direction? If we would do it, do you think that we
> >>> might get into trouble with future versions of maven?
> >>>
> >>> Regards
> >>> Carsten
> >>>
> >>>
> >>> --
> >>> Carsten Ziegeler
> >>> cziegeler@apache.org
> >>>
> >>
> >>
> >>
> >> --
> >> Carsten Ziegeler
> >> cziegeler@apache.org
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >
> > --
> > Brett Porter
> > brett@apache.org
> > http://brettporter.wordpress.com/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
>
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
Yes, we were using that approach for years now and it turned out to be
too error prone as you have to keep the plugin configuration and the
dependency list in sync. It doesn't sound like a hard task first, but
in our case it caused trouble many times. That's why we would like to
have a single point of information.

Regards
Carsten

2011/11/7 Brett Porter <br...@apache.org>:
> The typical pattern used for this is an artefact filter applied to the configuration of the plugin, rather than information on the dependencies (like what the dependency plugin goals use). That was a feature of Maven 1 that we rejected upfront.
>
> In my experience, it's actually less verbose since you typically include or exclude just a handful, or can use wildcards, rather than having to put a property of each dependency.
>
> - Brett
>
> On 07/11/2011, at 11:55 AM, Carsten Ziegeler wrote:
>
>> Maybe a little bit more information :) We need this information just
>> for the build of the project containing this information. It's read by
>> a custom plugin. So even if the information would not end up in the
>> maven repository, we're fine.
>>
>> Carsten
>>
>> 2011/11/7 Carsten Ziegeler <cz...@apache.org>:
>>> Hi,
>>>
>>> in Apache Sling we have the need to add additional information to a
>>> dependency in a pom, basically it's just an xml attribute, like:
>>>
>>> <dependency sling:startlevel="1">
>>>
>>> Now, with a little bit of hacking we could get this working in our
>>> plugin be parsing or converting the pom xml file ourselves (we don't
>>> need pom inheritance or transitive handling of this additional
>>> information)
>>>
>>> The question now is, what do you think about it? Is there something
>>> planned in that direction? If we would do it, do you think that we
>>> might get into trouble with future versions of maven?
>>>
>>> Regards
>>> Carsten
>>>
>>>
>>> --
>>> Carsten Ziegeler
>>> cziegeler@apache.org
>>>
>>
>>
>>
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Meta information about dependencies in a pom?

Posted by Brett Porter <br...@apache.org>.
The typical pattern used for this is an artefact filter applied to the configuration of the plugin, rather than information on the dependencies (like what the dependency plugin goals use). That was a feature of Maven 1 that we rejected upfront.

In my experience, it's actually less verbose since you typically include or exclude just a handful, or can use wildcards, rather than having to put a property of each dependency.

- Brett

On 07/11/2011, at 11:55 AM, Carsten Ziegeler wrote:

> Maybe a little bit more information :) We need this information just
> for the build of the project containing this information. It's read by
> a custom plugin. So even if the information would not end up in the
> maven repository, we're fine.
> 
> Carsten
> 
> 2011/11/7 Carsten Ziegeler <cz...@apache.org>:
>> Hi,
>> 
>> in Apache Sling we have the need to add additional information to a
>> dependency in a pom, basically it's just an xml attribute, like:
>> 
>> <dependency sling:startlevel="1">
>> 
>> Now, with a little bit of hacking we could get this working in our
>> plugin be parsing or converting the pom xml file ourselves (we don't
>> need pom inheritance or transitive handling of this additional
>> information)
>> 
>> The question now is, what do you think about it? Is there something
>> planned in that direction? If we would do it, do you think that we
>> might get into trouble with future versions of maven?
>> 
>> Regards
>> Carsten
>> 
>> 
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/


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


Re: Meta information about dependencies in a pom?

Posted by Carsten Ziegeler <cz...@apache.org>.
Maybe a little bit more information :) We need this information just
for the build of the project containing this information. It's read by
a custom plugin. So even if the information would not end up in the
maven repository, we're fine.

Carsten

2011/11/7 Carsten Ziegeler <cz...@apache.org>:
> Hi,
>
> in Apache Sling we have the need to add additional information to a
> dependency in a pom, basically it's just an xml attribute, like:
>
> <dependency sling:startlevel="1">
>
> Now, with a little bit of hacking we could get this working in our
> plugin be parsing or converting the pom xml file ourselves (we don't
> need pom inheritance or transitive handling of this additional
> information)
>
> The question now is, what do you think about it? Is there something
> planned in that direction? If we would do it, do you think that we
> might get into trouble with future versions of maven?
>
> Regards
> Carsten
>
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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