Plugin for a new repository type in 2.7.1-01

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Plugin for a new repository type in 2.7.1-01

WATEL Mathieu

Hello,

 

I am new to Nexus plugin development. I followed the content of https://github.com/sonatype/nexus-oss/blob/7868e9dcb9c82449cdc81f452c10306dad9a6a5e/testsupport/nexus-it-helper-plugin/src/main/java/org/sonatype/nexus/plugins/repository/ and reversed M2Repository and other classes to do what seems required to declare a new repository.

 

I created 3 Maven projects:

·         mx-setups-plugin: the plugin itself, ContentClass, Configurator, Configuration, interface declaring the repository, its implementation.

o   I have a unit test that runs correctly.

·         mx-setups-client: the client side of my plugin, inspired by the nexus-obr-plugin found on your GitHub.

·         mx-setups-it: integration testing using NexusRunningParametrizedITSupport with bundle org.sonatype.nexus.assemblies:nexus-bundle-template:zip:bundle.

o   In the configureNexus method, I add my previous plugin through the resolution with dependency management. This works fine as I can see my bundle in folder target/it-data/<id>/nx/sonatype-work/nexus/plugin-repository.

o   My test first attempts to create a repository with my client interface.

 

Running my integration causes the following error:

org.sonatype.nexus.client.core.exception.NexusClientErrorResponseException: Repository being created &amp;quot;null&amp;quot; (repoId=mx.setups) has corresponding type that is not registered in Core: Repository type org.sonatype.nexus.proxy.repository.Repository:mx-setups-proxy is unknown to Nexus Core. It is probably contributed by an old Nexus plugin. Please contact plugin developers to upgrade the plugin, and register the new repository type(s) properly!

 

mx-setups-proxy is the provider id I set on the client side, and it matches the one I declared on server side. I checked that my bundle has the sisu folder and it looks fine.

 

I am getting completely stuck. Can you please give me tips on things to check for or something obvious that I missed?

 

Many thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

mgainty


 

From: [hidden email]
To: [hidden email]
Date: Wed, 5 Mar 2014 08:52:38 +0000
Subject: [nexus-dev] Plugin for a new repository type in 2.7.1-01

Hello,

 

I am new to Nexus plugin development. I followed the content of https://github.com/sonatype/nexus-oss/blob/7868e9dcb9c82449cdc81f452c10306dad9a6a5e/testsupport/nexus-it-helper-plugin/src/main/java/org/sonatype/nexus/plugins/repository/ and reversed M2Repository and other classes to do what seems required to declare a new repository.

 

I created 3 Maven projects:

·         mx-setups-plugin: the plugin itself, ContentClass, Configurator, Configuration, interface declaring the repository, its implementation.

o   I have a unit test that runs correctly.

·         mx-setups-client: the client side of my plugin, inspired by the nexus-obr-plugin found on your GitHub.

·         mx-setups-it: integration testing using NexusRunningParametrizedITSupport with bundle org.sonatype.nexus.assemblies:nexus-bundle-template:zip:bundle.

o   In the configureNexus method, I add my previous plugin through the resolution with dependency management. This works fine as I can see my bundle in folder target/it-data/<id>/nx/sonatype-work/nexus/plugin-repository.

o   My test first attempts to create a repository with my client interface.

 

Running my integration causes the following error:

org.sonatype.nexus.client.core.exception.NexusClientErrorResponseException: Repository being created &amp;quot;null&amp;quot; (repoId=mx.setups) has corresponding type that is not registered in Core: Repository type org.sonatype.nexus.proxy.repository.Repository:mx-setups-proxy is unknown to Nexus Core.

MG>1)does the REPOSITORY mx.setups exist
MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy
MG>as displayed in nexus Repository View?

MG>3)Please confirm the version number of nexus-api you are using
MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

 It is probably contributed by an old Nexus plugin. Please contact plugin developers to upgrade the plugin, and register the new repository type(s) properly!

 

mx-setups-proxy is the provider id I set on the client side, and it matches the one I declared on server side. I checked that my bundle has the sisu folder and it looks fine.

 

I am getting completely stuck. Can you please give me tips on things to check for or something obvious that I missed?

 

Many thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

WATEL Mathieu

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

Re: Plugin for a new repository type in 2.7.1-01

Damian Bradicich


On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.


Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

WATEL Mathieu

I forgot to mention I have them.

 

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

 

During my searches through the various code pieces I found on the repo, I saw that using good old Plexus annotations could work. This explains the first 3 warnings. I then removed the Plexus annotations. In the process, I ‘diffed’ my repository implementation with the OBR one. I noticed something strange: even though the Repository interface is already implemented by my class through an interface I implement, it looks mandatory.

 

Were you aware of such behavior? Out of curiosity, do you know what component introduces this limitation?

 

Thanks,

Mathieu

 

De : Damian Bradicich [mailto:[hidden email]]
Envoyé : mercredi 5 mars 2014 16:10
À : [hidden email]
Objet : Re: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

 

On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

 

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

Jason Dillon-3

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

This indicates you have legacy plexus annotations, which should be replaced with jsr-330:

http://wiki.eclipse.org/Sisu/PlexusMigration


—jason


Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

Jason Dillon-3
In reply to this post by WATEL Mathieu

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

This indicates either your plugin is not built properly or you have mismatched gav details in your plugin impl.

Hard to say without actually seeing the code you are working on though.

—jason


Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

mgainty
In reply to this post by WATEL Mathieu
Mathieu:

Remember the old Spring Annotation @Component...@Named does the same thing using JSR330 annotations
@Named /*with JS2330 Injector use @Name to declare your bean */
 
There needs to be an injector defined *somewhere in nexus* to provide the injector for your Plugin
then again you are probably using sisu-guice?
stewart please confirm
 
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
 
If we comment this out as per suggestion McCulls then where does the injector come from?
Bon Chance
Martin


 


From: [hidden email]
To: [hidden email]
Date: Wed, 5 Mar 2014 15:35:14 +0000
Subject: RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

I forgot to mention I have them.

 

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

 

During my searches through the various code pieces I found on the repo, I saw that using good old Plexus annotations could work. This explains the first 3 warnings. I then removed the Plexus annotations. In the process, I ‘diffed’ my repository implementation with the OBR one. I noticed something strange: even though the Repository interface is already implemented by my class through an interface I implement, it looks mandatory.

 

Were you aware of such behavior? Out of curiosity, do you know what component introduces this limitation?

 

Thanks,

Mathieu

 

De : Damian Bradicich [mailto:[hidden email]]
Envoyé : mercredi 5 mars 2014 16:10
À : [hidden email]
Objet : Re: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

 

On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

 

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

WATEL Mathieu

It turns out my IT is working fine since I added the Repository interface to my repository implementation (which was already in the inherited interfaces through another one).

 

It now displays correctly when configuring my repository from the browser. There is still one issue though:

I thought that my repository template would be used when creating a new repository but it does not look like it is. How can I set the default values of a newly created repository? Especially the storage provider id. I am doing stuffs in the template that are not used at all!

 

@Martin: I am using what Nexus is using so I guess sisu-guice. I am using javax annotations, not Spring or any other Plexus stuffs (I only used old Plexus to follow the example on your Git). Note that this is a plain new plugin so I only used what I thought were the latest APIs.

 

Thanks,

Mathieu

 

De : Martin Gainty [mailto:[hidden email]]
Envoyé : jeudi 6 mars 2014 02:07
À : [hidden email]; [hidden email]
Objet : RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

Mathieu:

Remember the old Spring Annotation @Component...@Named does the same thing using JSR330 annotations
@Named /*with JS2330 Injector use @Name to declare your bean */
 
There needs to be an injector defined *somewhere in nexus* to provide the injector for your Plugin
then again you are probably using sisu-guice?
stewart please confirm
 
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
 
If we comment this out as per suggestion McCulls then where does the injector come from?
Bon Chance
Martin


 


From: [hidden email]
To: [hidden email]
Date: Wed, 5 Mar 2014 15:35:14 +0000
Subject: RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

I forgot to mention I have them.

 

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

 

During my searches through the various code pieces I found on the repo, I saw that using good old Plexus annotations could work. This explains the first 3 warnings. I then removed the Plexus annotations. In the process, I ‘diffed’ my repository implementation with the OBR one. I noticed something strange: even though the Repository interface is already implemented by my class through an interface I implement, it looks mandatory.

 

Were you aware of such behavior? Out of curiosity, do you know what component introduces this limitation?

 

Thanks,

Mathieu

 

De : Damian Bradicich [mailto:[hidden email]]
Envoyé : mercredi 5 mars 2014 16:10
À : [hidden email]
Objet : Re: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

 

On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

 

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

mgainty


 

From: [hidden email]
To: [hidden email]; [hidden email]
Date: Thu, 6 Mar 2014 08:49:32 +0000
Subject: RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01
ni

It turns out my IT is working fine since I added the Repository interface to my repository implementation (which was already in the inherited interfaces through another one).

 

It now displays correctly when configuring my repository from the browser. There is still one issue though:

I thought that my repository template would be used when creating a new repository but it does not look like it is. How can I set the default values of a newly created repository? Especially the storage provider id. I am doing stuffs in the template that are not used at all!

 

Martin>Not sure what you mean by repository template?

Martin>When you create a New Repository Group there are no defaults except for listing of available Repositories which Martin>you can aggregate in your new Repository Group into new Ordered Group Repository
Martin>When you create a New Hosted Repository: Operator is provided defaults for Provider, RepositoryPolicy, Martin>DeploymentPolicy, AccessSettings. ExpirationSettings
Martin>When you create a new Proxy Repository Operator is provided defaults for Provider,RepositoryPolicy, Martin>RemoteStorageLocation, AccessSettings, ChecksumPolicy, ExpirationSettings
Martin>When you create a Virtual Repository defaults are provided for Provider, SynchroniseOnStartup

Martin>I didnt see Template perhaps you can show us where Repository Templates are created in Nexus? 
Martin>Merci

Martin>

 

 

@Martin: I am using what Nexus is using so I guess sisu-guice. I am using javax annotations, not Spring or any other Plexus stuffs (I only used old Plexus to follow the example on your Git). Note that this is a plain new plugin so I only used what I thought were the latest APIs.

 

Thanks,

Mathieu

 

De : Martin Gainty [mailto:[hidden email]]
Envoyé : jeudi 6 mars 2014 02:07
À : [hidden email]; [hidden email]
Objet : RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

Mathieu:

Remember the old Spring Annotation @Component...@Named does the same thing using JSR330 annotations
@Named /*with JS2330 Injector use @Name to declare your bean */
 
There needs to be an injector defined *somewhere in nexus* to provide the injector for your Plugin
then again you are probably using sisu-guice?
stewart please confirm
 
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
 
If we comment this out as per suggestion McCulls then where does the injector come from?
Bon Chance
Martin


 


From: [hidden email]
To: [hidden email]
Date: Wed, 5 Mar 2014 15:35:14 +0000
Subject: RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

I forgot to mention I have them.

 

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

 

During my searches through the various code pieces I found on the repo, I saw that using good old Plexus annotations could work. This explains the first 3 warnings. I then removed the Plexus annotations. In the process, I ‘diffed’ my repository implementation with the OBR one. I noticed something strange: even though the Repository interface is already implemented by my class through an interface I implement, it looks mandatory.

 

Were you aware of such behavior? Out of curiosity, do you know what component introduces this limitation?

 

Thanks,

Mathieu

 

De : Damian Bradicich [mailto:[hidden email]]
Envoyé : mercredi 5 mars 2014 16:10
À : [hidden email]
Objet : Re: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

 

On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

 

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

Reply | Threaded
Open this post in threaded view
|

RE: Plugin for a new repository type in 2.7.1-01

WATEL Mathieu

Martin>Not sure what you mean by repository template?

Martin>When you create a New Repository Group there are no defaults except for listing of available Repositories which

Martin>you can aggregate in your new Repository Group into new Ordered Group Repository
Martin>When you create a New Hosted Repository: Operator is provided defaults for Provider, RepositoryPolicy,

Martin>DeploymentPolicy, AccessSettings. ExpirationSettings
Martin>When you create a new Proxy Repository Operator is provided defaults for Provider,RepositoryPolicy,

Martin>RemoteStorageLocation, AccessSettings, ChecksumPolicy, ExpirationSettings
Martin>When you create a Virtual Repository defaults are provided for Provider, SynchroniseOnStartup

 

These are the values I would like to default. I noticed that when I create a hosted repository, change its provider, other fields in the UI get changed. I assumed these come from the repository template.



Martin>I didnt see Template perhaps you can show us where Repository Templates are created in Nexus? 
Martin>Merci

It was previously mentioned in this thread by Damian Bradicich. I used the OBR implementation as reference: https://github.com/sonatype/nexus-oss/tree/master/plugins/osgi/nexus-obr-plugin/src/main/java/org/sonatype/nexus/obr/templates

I extrapolated that the template provider gets invoked when the operator creates a new repo. The corresponding template would then fill the defaults for what will be presented to the operator. Was this supposition wrong? Or should I use the some other class (the repository configurator)? In my case I would like to properly set the repository storage provider id as I am currently not satisfied with the dirty code I did to make this work.

 

Thanks,

Mathieu

 

De : Martin Gainty [hidden email]
Envoyé : jeudi 6 mars 2014 02:07
À : [hidden email]; [hidden email]
Objet : RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

Mathieu:

Remember the old Spring Annotation @Component...@Named does the same thing using JSR330 annotations
@Named /*with JS2330 Injector use @Name to declare your bean */
 
There needs to be an injector defined *somewhere in nexus* to provide the injector for your Plugin
then again you are probably using sisu-guice?
stewart please confirm
 
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
 
If we comment this out as per suggestion McCulls then where does the injector come from?
Bon Chance
Martin


 


From: [hidden email]
To: [hidden email]
Date: Wed, 5 Mar 2014 15:35:14 +0000
Subject: RE: [nexus-dev] Plugin for a new repository type in 2.7.1-01

I forgot to mention I have them.

 

What is my best option? Debugging Nexus? The only thing that intrigues me in the Nexus instance launched during IT is:

 

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsContentClass

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepository

2014-03-05 16:15:17 WARN  [jetty-main-thread-1]  org.sonatype.nexus.guice.NexusAnnotatedBeanModule$NexusTypeBinder - Found legacy plexus component: mw.nexus.plugin.mx.setups.repositories.MxSetupsRepositoryConfigurator

2014-03-05 16:15:18 WARN  [jetty-main-thread-1]  mw.nexus.plugin.mx.setups.MxSetupsPlugin - Missing plugin project metadata: /META-INF/maven/mw.nexus.plugin/nexus-mx-setups-plugin/pom.properties

 

During my searches through the various code pieces I found on the repo, I saw that using good old Plexus annotations could work. This explains the first 3 warnings. I then removed the Plexus annotations. In the process, I ‘diffed’ my repository implementation with the OBR one. I noticed something strange: even though the Repository interface is already implemented by my class through an interface I implement, it looks mandatory.

 

Were you aware of such behavior? Out of curiosity, do you know what component introduces this limitation?

 

Thanks,

Mathieu

 

De : Damian Bradicich [hidden email]
Envoyé : mercredi 5 mars 2014 16:10
À : [hidden email]
Objet : Re: [nexus-dev] Plugin for a new repository type in 2.7.1-01

 

 

On Wed, Mar 5, 2014 at 9:44 AM, WATEL Mathieu <[hidden email]> wrote:

MG>1)does the REPOSITORY mx.setups exist

 

MW: The problem actually occurs when I try to programmatically create it at the beginning of my test with:

repositories().create(IMxSetupsHostedRepository.class, "mx.setups").save();

 

 

MG>2)does mx.setups you are referencing reference an actual proxy-repository mx-setups-proxy

MG>as displayed in nexus Repository View?

 

MW: the content class I currently have is misleading (mx-setups-proxy) as it is a hosted repository. Note that if I deploy my plugin on an actual Nexus instance, creating a hosted repository gives me access to my content class through the Provider combobox. Trying to save it will cause the exact same issue raised in my integration test.

 


MG>3)Please confirm the version number of nexus-api you are using

MG>4)Please confirm the version number of nexus-core you are using

MG>Please confirm these details

 

I am using a property nexus.version in my root POM that I set to 2.7.1-01.

 

Note: I double-checked my POMs and I was not using a provided scope for nexus-api. This is now corrected.

 

Thanks,

Mathieu

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

 

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.

*******************************

This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.