You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@archiva.apache.org by Jim Sellers <ji...@gmail.com> on 2010/11/16 23:19:13 UTC

consumer documentation out of date?

Hi all.

I'm trying to write a consumer that deletes released artifacts by groupId
and date (loaded from a properties file in the conf directory).  We're doing
this because we don't need to keep all released binaries ever built and to
address disk issues.  I'm basing my impl on RepositoryPurgeConsumer.

However I'm having some trouble when trying to follow the docs.  Even
looking looking at the latest snapshot version [1] or the sample plugin
[2].  From MRM-1015 [3] I would guess that some spring config is now
needed.  If I unpack archiva-core-consumers-1.3.1.jar I find both plexus
config and spring config.

My questions come down to:
1) What config do I need in my pom to generate the correct files?
2) What spring config do I need to have?
3) What plexus comments do I need (if any) to add to my code?

Thanks in advance for any help.
Jim


[1]
http://archiva.apache.org/docs/1.4-SNAPSHOT/customising/writing-consumer.html
[2] http://svn.apache.org/repos/asf/archiva/sandbox/archiva-consumer-plugin/
[3] http://jira.codehaus.org/browse/MRM-1015

Re: consumer documentation out of date?

Posted by Brett Porter <br...@apache.org>.
On 18/11/2010, at 1:57 PM, Deng Ching wrote:

>> 
>> What I meant by # 1 was there any specific pom config that I needed to do in
>> order to build a plugin.  e.g. in the doc in the website it talks about the
>> plexus-maven-plugin.  I'll start with just using the archiva-consumers as my
>> parent.
> 
> It shouldn't be necessary to use archiva-consumers as parent, but
> there's no problem in using it too.

Using this would only make sense if it's to be contributed into Archiva though - otherwise you'll end up wanting your own parent structure.

> 
> As an additional note, if you will be using Plexus to wire the
> components in your consumer instead of Spring, you'd need to have this
> configuration in your POM:
> 
>     <plugin>
>        <groupId>org.codehaus.plexus</groupId>
>        <artifactId>plexus-component-metadata</artifactId>
>        <version>1.0-beta-3.0.5</version>
>        <executions>
>          <execution>
>            <id>generate</id>
>            <phase>generate-resources</phase>
>            <goals>
>              <goal>generate-metadata</goal>
>            </goals>
>          </execution>
>        </executions>
>      </plugin>
> 
> We've replaced the plexus-maven-plugin with the above. This is already
> configured in archiva-consumers POM 1.3.1, so if you're using that as
> your parent already, you don't need to configure the above plugin in
> your consumer's POM.

This (and hopefully the docs) should continue to work. The Plexus API and metadata has been fully mapped onto Spring. However, if you want to update it to use Spring directly this plugin won't be needed (and we'd be most appreciated of an updates to the docs along those lines!)

Cheers,
Brett

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


Re: consumer documentation out of date?

Posted by Deng Ching <od...@gmail.com>.
On Wed, Nov 17, 2010 at 9:56 PM, Jim Sellers <ji...@gmail.com> wrote:
> Hi Deng.
>
> Thanks a lot, that looks like a great place for me to start.  I'll see if I
> can have more success with this.

You're welcome :)

>
> What I meant by # 1 was there any specific pom config that I needed to do in
> order to build a plugin.  e.g. in the doc in the website it talks about the
> plexus-maven-plugin.  I'll start with just using the archiva-consumers as my
> parent.

It shouldn't be necessary to use archiva-consumers as parent, but
there's no problem in using it too.

As an additional note, if you will be using Plexus to wire the
components in your consumer instead of Spring, you'd need to have this
configuration in your POM:

     <plugin>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-component-metadata</artifactId>
        <version>1.0-beta-3.0.5</version>
        <executions>
          <execution>
            <id>generate</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>generate-metadata</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

We've replaced the plexus-maven-plugin with the above. This is already
configured in archiva-consumers POM 1.3.1, so if you're using that as
your parent already, you don't need to configure the above plugin in
your consumer's POM.

>
> Do you think that I should open a jira ticket for the consumer doc being out
> of date ?

Yes, that would be great :) Thanks!

-Deng

>
> Thanks for your help,
> Jim
>
>
> On Wed, Nov 17, 2010 at 3:55 AM, Deng Ching <od...@gmail.com> wrote:
>
>> Hi Jim,
>>
>> AFAICT, you can pattern it like one of the consumers here:
>>
>>
>> https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers
>>
>> You can probably take a look at ArtifactMissingChecksumsConsumer in
>> this module as an example. Since Archiva is now using Spring as the
>> container, you can configure your consumer as a Spring bean (see
>> src/main/resources/META-INF/spring-context.xml in the same module).
>> We're using the plexus-spring adapter which already does the
>> conversion of Plexus components to Spring beans.
>>
>> To plugin Plexus components to your consumer, just use the Plexus
>> component "role-hint" as the bean id when referencing the component in
>> spring. If no "role-hint" is specified, the default is the class' name
>> specified in the "role" attribute in camel case. For example in the
>> ArtifactMissingChecksumsConsumer bean config in the spring-context.xml
>> file I mentioned above, it references the bean "archivaConfiguration".
>> The implementation being referenced for that is
>> DefaultArchivaConfiguration. If you look at that class'
>> @plexus.component annotation, the "role" is
>> "org.apache.maven.archiva.configuration.ArchivaConfiguration" and
>> since no "role-hint" is specified, the role-hint/bean ID then is
>> "archivaConfiguration".
>>
>> I hope this answers questions #2 and #3. I'm not sure what you meant
>> by question #1.. can you please clarify? :)
>>
>> Thanks,
>> Deng
>>
>> On Wed, Nov 17, 2010 at 6:19 AM, Jim Sellers <ji...@gmail.com>
>> wrote:
>> > Hi all.
>> >
>> > I'm trying to write a consumer that deletes released artifacts by groupId
>> > and date (loaded from a properties file in the conf directory).  We're
>> doing
>> > this because we don't need to keep all released binaries ever built and
>> to
>> > address disk issues.  I'm basing my impl on RepositoryPurgeConsumer.
>> >
>> > However I'm having some trouble when trying to follow the docs.  Even
>> > looking looking at the latest snapshot version [1] or the sample plugin
>> > [2].  From MRM-1015 [3] I would guess that some spring config is now
>> > needed.  If I unpack archiva-core-consumers-1.3.1.jar I find both plexus
>> > config and spring config.
>> >
>> > My questions come down to:
>> > 1) What config do I need in my pom to generate the correct files?
>> > 2) What spring config do I need to have?
>> > 3) What plexus comments do I need (if any) to add to my code?
>> >
>> > Thanks in advance for any help.
>> > Jim
>> >
>> >
>> > [1]
>> >
>> http://archiva.apache.org/docs/1.4-SNAPSHOT/customising/writing-consumer.html
>> > [2]
>> http://svn.apache.org/repos/asf/archiva/sandbox/archiva-consumer-plugin/
>> > [3] http://jira.codehaus.org/browse/MRM-1015
>> >
>>
>

Re: consumer documentation out of date?

Posted by Jim Sellers <ji...@gmail.com>.
Hi Deng.

Thanks a lot, that looks like a great place for me to start.  I'll see if I
can have more success with this.

What I meant by # 1 was there any specific pom config that I needed to do in
order to build a plugin.  e.g. in the doc in the website it talks about the
plexus-maven-plugin.  I'll start with just using the archiva-consumers as my
parent.

Do you think that I should open a jira ticket for the consumer doc being out
of date ?

Thanks for your help,
Jim


On Wed, Nov 17, 2010 at 3:55 AM, Deng Ching <od...@gmail.com> wrote:

> Hi Jim,
>
> AFAICT, you can pattern it like one of the consumers here:
>
>
> https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers
>
> You can probably take a look at ArtifactMissingChecksumsConsumer in
> this module as an example. Since Archiva is now using Spring as the
> container, you can configure your consumer as a Spring bean (see
> src/main/resources/META-INF/spring-context.xml in the same module).
> We're using the plexus-spring adapter which already does the
> conversion of Plexus components to Spring beans.
>
> To plugin Plexus components to your consumer, just use the Plexus
> component "role-hint" as the bean id when referencing the component in
> spring. If no "role-hint" is specified, the default is the class' name
> specified in the "role" attribute in camel case. For example in the
> ArtifactMissingChecksumsConsumer bean config in the spring-context.xml
> file I mentioned above, it references the bean "archivaConfiguration".
> The implementation being referenced for that is
> DefaultArchivaConfiguration. If you look at that class'
> @plexus.component annotation, the "role" is
> "org.apache.maven.archiva.configuration.ArchivaConfiguration" and
> since no "role-hint" is specified, the role-hint/bean ID then is
> "archivaConfiguration".
>
> I hope this answers questions #2 and #3. I'm not sure what you meant
> by question #1.. can you please clarify? :)
>
> Thanks,
> Deng
>
> On Wed, Nov 17, 2010 at 6:19 AM, Jim Sellers <ji...@gmail.com>
> wrote:
> > Hi all.
> >
> > I'm trying to write a consumer that deletes released artifacts by groupId
> > and date (loaded from a properties file in the conf directory).  We're
> doing
> > this because we don't need to keep all released binaries ever built and
> to
> > address disk issues.  I'm basing my impl on RepositoryPurgeConsumer.
> >
> > However I'm having some trouble when trying to follow the docs.  Even
> > looking looking at the latest snapshot version [1] or the sample plugin
> > [2].  From MRM-1015 [3] I would guess that some spring config is now
> > needed.  If I unpack archiva-core-consumers-1.3.1.jar I find both plexus
> > config and spring config.
> >
> > My questions come down to:
> > 1) What config do I need in my pom to generate the correct files?
> > 2) What spring config do I need to have?
> > 3) What plexus comments do I need (if any) to add to my code?
> >
> > Thanks in advance for any help.
> > Jim
> >
> >
> > [1]
> >
> http://archiva.apache.org/docs/1.4-SNAPSHOT/customising/writing-consumer.html
> > [2]
> http://svn.apache.org/repos/asf/archiva/sandbox/archiva-consumer-plugin/
> > [3] http://jira.codehaus.org/browse/MRM-1015
> >
>

Re: consumer documentation out of date?

Posted by Deng Ching <od...@gmail.com>.
Hi Jim,

AFAICT, you can pattern it like one of the consumers here:

https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers

You can probably take a look at ArtifactMissingChecksumsConsumer in
this module as an example. Since Archiva is now using Spring as the
container, you can configure your consumer as a Spring bean (see
src/main/resources/META-INF/spring-context.xml in the same module).
We're using the plexus-spring adapter which already does the
conversion of Plexus components to Spring beans.

To plugin Plexus components to your consumer, just use the Plexus
component "role-hint" as the bean id when referencing the component in
spring. If no "role-hint" is specified, the default is the class' name
specified in the "role" attribute in camel case. For example in the
ArtifactMissingChecksumsConsumer bean config in the spring-context.xml
file I mentioned above, it references the bean "archivaConfiguration".
The implementation being referenced for that is
DefaultArchivaConfiguration. If you look at that class'
@plexus.component annotation, the "role" is
"org.apache.maven.archiva.configuration.ArchivaConfiguration" and
since no "role-hint" is specified, the role-hint/bean ID then is
"archivaConfiguration".

I hope this answers questions #2 and #3. I'm not sure what you meant
by question #1.. can you please clarify? :)

Thanks,
Deng

On Wed, Nov 17, 2010 at 6:19 AM, Jim Sellers <ji...@gmail.com> wrote:
> Hi all.
>
> I'm trying to write a consumer that deletes released artifacts by groupId
> and date (loaded from a properties file in the conf directory).  We're doing
> this because we don't need to keep all released binaries ever built and to
> address disk issues.  I'm basing my impl on RepositoryPurgeConsumer.
>
> However I'm having some trouble when trying to follow the docs.  Even
> looking looking at the latest snapshot version [1] or the sample plugin
> [2].  From MRM-1015 [3] I would guess that some spring config is now
> needed.  If I unpack archiva-core-consumers-1.3.1.jar I find both plexus
> config and spring config.
>
> My questions come down to:
> 1) What config do I need in my pom to generate the correct files?
> 2) What spring config do I need to have?
> 3) What plexus comments do I need (if any) to add to my code?
>
> Thanks in advance for any help.
> Jim
>
>
> [1]
> http://archiva.apache.org/docs/1.4-SNAPSHOT/customising/writing-consumer.html
> [2] http://svn.apache.org/repos/asf/archiva/sandbox/archiva-consumer-plugin/
> [3] http://jira.codehaus.org/browse/MRM-1015
>