Jump to: navigation, search

Difference between revisions of "Tycho/Nexus Unzip Plugin"

(Configuring a group as master for the unzip repository)
Line 1: Line 1:
 
'''<font color="red">WARNING - EARLY DRAFT</font>''': this plugin is not released yet and docs are in early draft and probably not complete/ [https://bugs.eclipse.org/bugs/show_bug.cgi?id=398731 buggy]. If you want to try it, you will need to build the plugin yourself from [http://git.eclipse.org/c/tycho/org.eclipse.tycho.nexus.git/ source].  
 
'''<font color="red">WARNING - EARLY DRAFT</font>''': this plugin is not released yet and docs are in early draft and probably not complete/ [https://bugs.eclipse.org/bugs/show_bug.cgi?id=398731 buggy]. If you want to try it, you will need to build the plugin yourself from [http://git.eclipse.org/c/tycho/org.eclipse.tycho.nexus.git/ source].  
  
 +
<br>
  
=Nexus Unzip Repository=
+
= Nexus Unzip Repository =
  
The Unzip Repository is a new Nexus repository type that shadows the build results of a standard Maven 2 repository and allows to browse into zip and jar artifacts. The use case is to offer p2 repositories that were built with Tycho packaging type <tt>eclipse-repository</tt> and deployed as zip to Nexus so that other Tycho projects can reference them.  
+
The Unzip Repository is a new Nexus repository type that shadows the build results of a standard Maven 2 repository and allows to browse into zip and jar artifacts. The use case is to offer p2 repositories that were built with Tycho packaging type <tt>eclipse-repository</tt> and deployed as zip to Nexus so that other Tycho projects can reference them.  
  
Example:
+
Example:  
* p2 repo zip as artifact in Maven 2 Repository: <br/><pre>http://<NEXUS_HOST>/nexus/content/repositories/public/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip</pre>
+
* Same artifact viewed as unzipped p2 repository using a virtual unzip repo named <tt>public.unzip</tt>:<br/>
+
<pre>http://<NEXUS_HOST>/nexus/content/repositories/public.unzip/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip-unzip</pre>
+
  
 +
*p2 repo zip as artifact in Maven 2 Repository: <br><pre>http://&lt;NEXUS_HOST&gt;/nexus/content/repositories/public/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip</pre>
 +
*Same artifact viewed as unzipped p2 repository using a virtual unzip repo named <tt>public.unzip</tt>:<br>
 +
<pre>http://&lt;NEXUS_HOST&gt;/nexus/content/repositories/'''public.unzip'''/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip'''-unzip'''</pre>
 +
<br>
  
==Installation and Configuration==
+
== Installation and Configuration ==
  
To enable a Nexus server to provide direct access to files inside zip/jar archives you need to deploy the Nexus Unzip Repository Plugin to the Nexus server instance and configure a new virtual repository using the Unzip Repository type.
+
To enable a Nexus server to provide direct access to files inside zip/jar archives you need to deploy the Nexus Unzip Repository Plugin to the Nexus server instance and configure a new virtual repository using the Unzip Repository type.  
  
===Deploying the plug-in===
+
=== Deploying the plug-in ===
  
# Stop the Nexus instance  
+
#Stop the Nexus instance  
# Navigate to the plugin repository in the work dir <tt>${NEXUS_WORK}/plugin-repository</tt>
+
#Navigate to the plugin repository in the work dir <tt>${NEXUS_WORK}/plugin-repository</tt>  
# Unzip the <tt>unzip-repository-plugin-<VERSION>-bundle.zip</tt> into the <tt>plugin-repository/</tt> folder  
+
#Unzip the <tt>unzip-repository-plugin-&lt;VERSION&gt;-bundle.zip</tt> into the <tt>plugin-repository/</tt> folder  
# Restart the Nexus server  
+
#Restart the Nexus server  
# Verify that the Unzip Repository Plugin is activated, by opening the Plugin Console from the Administration sub-menu of the Nexus UI
+
#Verify that the Unzip Repository Plugin is activated, by opening the Plugin Console from the Administration sub-menu of the Nexus UI
  
===Configuring an unzip repository (using hosted/proxy/virtual repo as master)===
+
=== Configuring an unzip repository (using hosted/proxy/virtual repo as master) ===
  
WARNING: Using the Nexus Web UI you can only assign hosted, proxy and virtual repositories as the master repository. To configure a group as the used master , you need to configure it directly in the configuration file on the Nexus host machine. Details in the section below.
+
WARNING: Using the Nexus Web UI you can only assign hosted, proxy and virtual repositories as the master repository. To configure a group as the used master , you need to configure it directly in the configuration file on the Nexus host machine. Details in the section below.  
  
# Open the Nexus Web UI  
+
#Open the Nexus Web UI  
# Login with your administrative user
+
#Login with your administrative user  
# Choose the Repositories View from the side menu  
+
#Choose the Repositories View from the side menu  
# Open the Add menu and choose Virtual Repository. The detail view below the repository list opens a form to specify further repository configuration.
+
#Open the Add menu and choose Virtual Repository. The detail view below the repository list opens a form to specify further repository configuration.  
# Enter a unique repository ID and choose a (display) name. You cannot alter the repository type.
+
#Enter a unique repository ID and choose a (display) name. You cannot alter the repository type.  
# Choose <tt>Unzip Repository Template</tt> as the repository provider. The repository format is fixed.
+
#Choose <tt>Unzip Repository Template</tt> as the repository provider. The repository format is fixed.  
# Select the intended repository from the list of the source nexus repositories
+
#Select the intended repository from the list of the source nexus repositories  
# Save the repository config
+
#Save the repository config  
# To verify the setup of the unzip repository, you can now select the repository from the repository list and start browsing the folders *and* into archives that you have deployed into the previously selected master repository. You can also open the URL given in the Repository Path column to browse in the standard web browser.
+
#To verify the setup of the unzip repository, you can now select the repository from the repository list and start browsing the folders *and* into archives that you have deployed into the previously selected master repository. You can also open the URL given in the Repository Path column to browse in the standard web browser.
  
=== Configuring a group as master for the unzip repository ===
+
=== Configuring a group as master for the unzip repository ===
  
All groups and repositories configuration are stored in the nexus.xml config file in the Nexus work folder. You need to edit this directly in a text editor to configure a group as master.
+
All groups and repositories configuration are stored in the nexus.xml config file in the Nexus work folder. You need to edit this directly in a text editor to configure a group as master.  
# Stop Nexus
+
 
# Open <tt>${NEXUS_WORK}/conf/nexus.xml</tt>
+
#Stop Nexus  
# Add a new repository element with following structure
+
#Open <tt>${NEXUS_WORK}/conf/nexus.xml</tt>  
<pre>
+
#Add a new repository element with following structure
<repository>
+
<pre>&lt;repository&gt;
       <id>master.group.unzip</id>
+
       &lt;id&gt;master.group.unzip&lt;/id&gt;
       <name>Group Unzip</name>
+
       &lt;name&gt;Group Unzip&lt;/name&gt;
       <providerRole>org.sonatype.nexus.proxy.repository.ShadowRepository</providerRole>
+
       &lt;providerRole&gt;org.sonatype.nexus.proxy.repository.ShadowRepository&lt;/providerRole&gt;
       <providerHint>org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository</providerHint>
+
       &lt;providerHint&gt;org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository&lt;/providerHint&gt;
       <localStatus>IN_SERVICE</localStatus>
+
       &lt;localStatus&gt;IN_SERVICE&lt;/localStatus&gt;
       <notFoundCacheActive>true</notFoundCacheActive>
+
       &lt;notFoundCacheActive&gt;true&lt;/notFoundCacheActive&gt;
       <notFoundCacheTTL>15</notFoundCacheTTL>
+
       &lt;notFoundCacheTTL&gt;15&lt;/notFoundCacheTTL&gt;
       <userManaged>true</userManaged>
+
       &lt;userManaged&gt;true&lt;/userManaged&gt;
       <exposed>true</exposed>
+
       &lt;exposed&gt;true&lt;/exposed&gt;
       <browseable>true</browseable>
+
       &lt;browseable&gt;true&lt;/browseable&gt;
       <writePolicy>READ_ONLY</writePolicy>
+
       &lt;writePolicy&gt;READ_ONLY&lt;/writePolicy&gt;
       <searchable>true</searchable>
+
       &lt;searchable&gt;true&lt;/searchable&gt;
       <localStorage>
+
       &lt;localStorage&gt;
         <provider>file</provider>
+
         &lt;provider&gt;file&lt;/provider&gt;
       </localStorage>
+
       &lt;/localStorage&gt;
       <externalConfiguration>
+
       &lt;externalConfiguration&gt;
         <masterRepositoryId>master.group</masterRepositoryId>
+
         &lt;masterRepositoryId&gt;master.group&lt;/masterRepositoryId&gt;
         <synchronizeAtStartup>false</synchronizeAtStartup>
+
         &lt;synchronizeAtStartup&gt;false&lt;/synchronizeAtStartup&gt;
         <useVirtualVersion>true</useVirtualVersion>
+
         &lt;useVirtualVersion&gt;true&lt;/useVirtualVersion&gt;
       </externalConfiguration>
+
       &lt;/externalConfiguration&gt;
     </repository>
+
     &lt;/repository&gt;
</pre>
+
</pre>  
Note that you write the repository id (not the name) of the group in the <tt>masterRepositoryId</tt> element.
+
Note that you write the repository id (not the name) of the group in the <tt>masterRepositoryId</tt> element. <br>4. Restart Nexus  
<br/>4. Restart Nexus
+
  
 
[[Category:Tycho]]
 
[[Category:Tycho]]

Revision as of 05:27, 20 February 2013

WARNING - EARLY DRAFT: this plugin is not released yet and docs are in early draft and probably not complete/ buggy. If you want to try it, you will need to build the plugin yourself from source.


Nexus Unzip Repository

The Unzip Repository is a new Nexus repository type that shadows the build results of a standard Maven 2 repository and allows to browse into zip and jar artifacts. The use case is to offer p2 repositories that were built with Tycho packaging type eclipse-repository and deployed as zip to Nexus so that other Tycho projects can reference them.

Example:

  • p2 repo zip as artifact in Maven 2 Repository:
    http://<NEXUS_HOST>/nexus/content/repositories/public/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip
  • Same artifact viewed as unzipped p2 repository using a virtual unzip repo named public.unzip:
http://<NEXUS_HOST>/nexus/content/repositories/'''public.unzip'''/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip'''-unzip'''


Installation and Configuration

To enable a Nexus server to provide direct access to files inside zip/jar archives you need to deploy the Nexus Unzip Repository Plugin to the Nexus server instance and configure a new virtual repository using the Unzip Repository type.

Deploying the plug-in

  1. Stop the Nexus instance
  2. Navigate to the plugin repository in the work dir ${NEXUS_WORK}/plugin-repository
  3. Unzip the unzip-repository-plugin-<VERSION>-bundle.zip into the plugin-repository/ folder
  4. Restart the Nexus server
  5. Verify that the Unzip Repository Plugin is activated, by opening the Plugin Console from the Administration sub-menu of the Nexus UI

Configuring an unzip repository (using hosted/proxy/virtual repo as master)

WARNING: Using the Nexus Web UI you can only assign hosted, proxy and virtual repositories as the master repository. To configure a group as the used master , you need to configure it directly in the configuration file on the Nexus host machine. Details in the section below.

  1. Open the Nexus Web UI
  2. Login with your administrative user
  3. Choose the Repositories View from the side menu
  4. Open the Add menu and choose Virtual Repository. The detail view below the repository list opens a form to specify further repository configuration.
  5. Enter a unique repository ID and choose a (display) name. You cannot alter the repository type.
  6. Choose Unzip Repository Template as the repository provider. The repository format is fixed.
  7. Select the intended repository from the list of the source nexus repositories
  8. Save the repository config
  9. To verify the setup of the unzip repository, you can now select the repository from the repository list and start browsing the folders *and* into archives that you have deployed into the previously selected master repository. You can also open the URL given in the Repository Path column to browse in the standard web browser.

Configuring a group as master for the unzip repository

All groups and repositories configuration are stored in the nexus.xml config file in the Nexus work folder. You need to edit this directly in a text editor to configure a group as master.

  1. Stop Nexus
  2. Open ${NEXUS_WORK}/conf/nexus.xml
  3. Add a new repository element with following structure
<repository>
      <id>master.group.unzip</id>
      <name>Group Unzip</name>
      <providerRole>org.sonatype.nexus.proxy.repository.ShadowRepository</providerRole>
      <providerHint>org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository</providerHint>
      <localStatus>IN_SERVICE</localStatus>
      <notFoundCacheActive>true</notFoundCacheActive>
      <notFoundCacheTTL>15</notFoundCacheTTL>
      <userManaged>true</userManaged>
      <exposed>true</exposed>
      <browseable>true</browseable>
      <writePolicy>READ_ONLY</writePolicy>
      <searchable>true</searchable>
      <localStorage>
        <provider>file</provider>
      </localStorage>
      <externalConfiguration>
        <masterRepositoryId>master.group</masterRepositoryId>
        <synchronizeAtStartup>false</synchronizeAtStartup>
        <useVirtualVersion>true</useVirtualVersion>
      </externalConfiguration>
    </repository>

Note that you write the repository id (not the name) of the group in the masterRepositoryId element.
4. Restart Nexus