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-unsubscr...@maven.apache.org
>> For additional commands, e-mail: dev-h...@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
cziege...@apache.org

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

Reply via email to