- Q. How can I modify the javascript files while nexus is running?
- Q. How do I configure Nexus so I can build Maven?
- Q. How do I debug Nexus?
- Q. I am interested in Nexus "guts"...
- Q. How do I change my working directory?/How do I add parameters to the plexus context?
- Q. How do i secure a new restlet resource URI?
Q. How can I modify the javascript files while nexus is running?
A. You need to uncomment the following servlet from the runtime/apps/nexus/webapp/WEB-INF/web.xml
<!--
Uncomment this if you need to edit JavaScript files and other resources
while Jetty is running (to prevent it from locking everything).
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value>
</init-param>
</servlet> -->
Q. How do I configure Nexus so I can build Maven?
A. NOTE: This is assuming you have a default install of Nexus.
You need to add the 'Codehaus Snapshots' and 'Apache Snapshots' to your 'Public Repositories' group.
- Login to Nexus
- Click 'Groups' in the Confguration left navigation menu.
- Click on the 'Public Repositories' in the 'Groups' tab.
- Drag 'Codehaus Snapshots' and 'Apache Snapshots' from the 'Available Repositories' to 'Ordered Group Repositories'
- Click Save.
- No go Build Maven.
Q. How do I debug Nexus?
A. It is actually very simple to run nexus in debug mode.
- Edit the wrapper.conf file ( nexus-base-dir/conf )
- Uncomment or add the following parameters ( If you have modified your wrapper.conf in any way, the numbers in the properties below, may not apply, verify the incrementing based upon your wrapper.conf )
wrapper.java.additional.5=-Xdebug wrapper.java.additional.6=-Xnoagent wrapper.java.additional.7=-Djava.compiler=NONE wrapper.java.additional.8=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
- Now when you run the nexus launch script, nexus will start and wait for a debugger to attach to port 8000 ( which of course you can change, using the properties above )
- Now you can use your debugger of choice to attach to nexus. (See 'Setting up Eclipse' section at Codehaus for details on how to setup eclipse IDE to attach to maven, which is easily applied to debugging nexus as well).
Q. I am interested in Nexus "guts"...
Q. How do I change my working directory?/How do I add parameters to the plexus context?
a. There are 2 ways to change your working directory (or any plexus parameter for that matter).
The first is the use of the plexus.properties file (location in bundle-root/conf). Any parameters added to this file, will be available in the plexus context on launch. The second is the use of environment variables. If you add an environment variable named 'plexus-blah' the 'blah' portion will be added to the plexus context.
An example (for working directory) would be to set either nexus-work in the plexus.properties file OR set plexus-nexus-work as an environment variable
Note that environment variables will always override the plexus.properties parameters (if duplicated in both areas)
Note that the environment variable parameters are only supported in nexus 1.0 and greater. Also, previous to nexus 1.0, nexus-work was labeled as work in plexus.properties
Q. How do i secure a new restlet resource URI?
A. There are a few steps that need to be taken:
- Create new privileges for your new resource URI
- edit the nexus-configuration/src/main/resources/META-INF/nexus/security.xml file
- add new <privilege> items for your new URI (one for each method, create/read/update/delete)
- can simply copy an existing group of privileges for a uri, and modify fields to your new uri (and of course new id, name, description)
- the permission string you enter can be anything of your choosing (that is not already in use), i.e. nexus:somenewresource
- (Optional) Add the new privilege to any of the default roles that will require that privilege
- You will need to create an upgrade class in nexus-configuration/src/main/java/org/sonatype/nexus/configuration/security/upgrade to add these new privileges upon upgrade
- In certain cases there may already be an upgrade path in the trunk for latest release, so can simply append changes to that class (i.e. for 1.1 there is the Upgrade100to200 class)
- If added to any roles, will also need to handle that in the upgrade
- When updating roles, make sure they exist first, as the user may have removed them, in that case we will not recreate and insert the new privilege
- Add the new permission string and uri to web.xml (for jsecurity linking)
- in nexus-webapp/src/main/webapp/WEB-INF/web.xml add your new url to the apiFilter in the [urls] section
- example
/service//new_url/* = authcBasic,perms[nexus:somenewresource] /service//new_url = authcBasic,perms[nexus:somenewresource]
- That's it, your new resource URI is now protected by privilege(s)