Author Archives: Damian Bradicich

Browsing Javadocs, Archives, and Sources with Nexus Pro 1.5.0


February 2, 2010 By Damian Bradicich

If you’ve ever wondered about the contents a JAR or artifact in a Maven repository, you’ve probably had the experience of having to download and unpack it on your local workstation just to see what it contains.    It shouldn’t be this difficult and tedious to inspect an archive in a remote repository, and with Nexus Professional 1.5.0 we’ve added the capability to browse the contents of an archive.  In addition, we’ve built-in some intelligence that allows you to directly browse Javadoc contained in JAR archives.   In this post, I’m going to give a quick tour of this new feature now available in Nexus Professional 1.5.0.

Browsing Repository Archives

The Archive Browser Plugin will allow you to browse the contents of any JAR, WAR, EAR or ZIP file in the Nexus UI (or over REST if you so desire).  You can now view the contents of source JARs, view html documentation stored in javadoc JARs, or browse the contents of the archives, to validate contents. Continue reading

Announcing Nexus 1.5.0: LDAP, Archive Browsing, Javadoc, and More


January 28, 2010 By Damian Bradicich

Sonatype is pleased to announce the availability of Nexus 1.5.0.   The major announcement? We’ve moved our LDAP integration into Nexus Open Source.  In addition to the LDAP changes, this release also contains some important features:  Nexus Open Source now ships with the Remote Repository Browsing plugin, and Nexus Professional now has the capability to browse repository archives and serve Javadoc.    Nexus Professional has two new plugins: the new Enterprise LDAP plugin which supports multiple LDAP servers and provides caching options for LDAP integration, and a new Branding plugin which allows you to customize the appearance of the Nexus UI.

Downloading Nexus 1.5.0

If you are already using Nexus, it is easy to upgrade.   Download the distribution, unpack it next to your sonatype-work/ directory – that’s all it takes to upgrade.   If you haven’t installed Nexus yet, download a distribution, unpack it, and run the appropriate script under ${nexus_home}/bin/jsw.   If you are not yet using a repository manager, now’s the time.

The rest of this post provides an overview of some of the release highlights. Continue reading

Writing a Nexus Plugin Using m2eclipse


January 8, 2010 By Damian Bradicich

nexus-small

In this post, I’m going to walk you through the process of creating a new Nexus plugin using the m2eclipse plugin for eclipse from start to finish including all steps in the process.  After reading this post you will know about the easiest way to get started working on your own Nexus plugin.

Some things to note are that I am using the latest m2e 0.9.9 dev build available from the http://m2eclipse.sonatype.org/update-dev update site. I am also using eclipse 3.5.1.  All maven builds have been done using local build of latest maven 3.0-SNAPSHOT, however, that is not a requirement for the plugins to work, just a recommendation as maven 3 (in my opinion) is much better than maven 2 :)

Continue reading

Javascript Compression in Nexus


November 9, 2009 By Damian Bradicich

The Nexus UI uses Ext JS, a very powerful javascript library. The ext javascript library is a fairly large file on its own (even though it is an aggregation itself of all extjs library files, and compressed), not to mention all of the javascript files that we introduced to build the Nexus UI.  In total, we are working with roughly 3-4mb of javascript and css files.  As you can imagine, the first time you crank up your browser to access Nexus, it can take a long period of time to download all these resources.  As the UI is the user’s perspective on Nexus, this just needed to change.  So we decided to compress our resources, and did this using the YUI Compressor Maven Plugin.

Using this plugin, we were able to take our 30-40 javascript files (plus the monolithic ext-all.js file) and 4-5 css files, and aggregate them into 2 files, sonatype-all.js and sonatype-all.css.  The total size now less that 1mb (including the ext-all.js file) for both.  So not only have we made the content size 3-4 times smaller, but the number of requests has been cut 20 fold (or more!!).  This makes the UI load blazingly fast.

So I just wanted to get the word out, about how handy this maven plugin is, and how easy it is to use.  We only use the aggregation and compression offered by the plugin, but it offers a lot more than I can cover here. You can browse their website to get more details.

So here is the plugin configuration in our nexus-webapp pom.xml file

<plugin>
  <groupId>net.sf.alchim</groupId>
  <artifactId>yuicompressor-maven-plugin</artifactId>
  <executions>
    <execution>
      <id>jsfiles</id>
      <goals>
        <goal>compress</goal>
      </goals>
      <configuration>
        <aggregations>
          <aggregation>
            <!-- the ultimate javascript file that is served up to the browser -->
            <output>${compressed-dir}/js/sonatype-all.js</output>
            <!-- files to include, path relative to output's directory or absolute path-->
            <includes>
              <include>${basedir}/src/main/webapp/ext-2.2/adapter/ext/ext-base.js</include>
              <include>${basedir}/src/main/webapp/ext-2.2/ext-all.js</include>
              <include>${compressed-dir}/js/extensions/ext-override.js</include>
              <include>${compressed-dir}/js/filetree/js/Ext.ux.form.BrowseButton.js</include>
              <include>${compressed-dir}/js/Sonatype.js</include>
              <include>${compressed-dir}/js/extensions/Ext.messagebox.js</include>
              <include>${compressed-dir}/js/extensions/Ext.form.js</include>
              <include>${compressed-dir}/js/extensions/SearchField.js</include>
              <include>${compressed-dir}/js/extensions/Sonatype.ext.FeedGrid.js</include>
              <include>${compressed-dir}/js/extensions/Ext.tree.js</include>
              <include>${compressed-dir}/js/extensions/MultiSelectTree.js</include>
              <include>${compressed-dir}/js/extensions/TwinPanelController.js</include>
              <include>${compressed-dir}/js/extensions/Sonatype.events.js</include>
              <include>${compressed-dir}/js/extensions/Sonatype.navigation.js</include>
              <include>${compressed-dir}/js/extensions/Sonatype.panels.js</include>
              <include>${compressed-dir}/js/Sonatype.utils.js</include>
              <include>${compressed-dir}/js/Sonatype.config.js</include>
              <include>${compressed-dir}/js/Sonatype.lib.js</include>
              <include>${compressed-dir}/js/Sonatype.resources.js</include>
              <include>${compressed-dir}/js/Sonatype.headLinks.js</include>
              <include>${compressed-dir}/js/Sonatype.view.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.referenceData.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.resources.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.FeedViewPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.ArtifactInformationPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.ArtifactContainer.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.SearchResultGrid.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.SearchPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.LogsViewPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.ServerEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RoutesEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.SchedulesEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.UserEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RoleEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.PrivilegeEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.AbstractRepoPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.FileUploadPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepoMaintPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.IndexBrowserPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepositoryBrowserContainer.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepoEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.GroupsEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepoServer.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepoTargetEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.helpAbout.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.LogEditPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.MirrorConfigPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.UserBrowserPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.UserPrivilegeBrowserPanel.js</include>
              <include>${compressed-dir}/js/repoServer/repoServer.RepoSummaryPanel.js</include>
            </includes>
          </aggregation>
        </aggregations>
      </configuration>
    </execution>
    <execution>
      <id>cssfiles</id>
      <goals>
        <goal>compress</goal>
      </goals>
      <configuration>
        <aggregations>
          <aggregation>
            <!-- the ultimate css file that is served up to the browser -->
            <output>${compressed-dir}/style/sonatype-all.css</output>
            <!-- files to include, path relative to output's directory or absolute path-->
            <includes>
              <include>${compressed-dir}/style/Sonatype.css</include>
            </includes>
          </aggregation>
        </aggregations>
      </configuration>
    </execution>
  </executions>
  <configuration>
    <!-- where to put the generate files -->
    <outputDirectory>${compressed-dir}</outputDirectory>
    <!-- directory where source files will be pulled from -->
    <sourceDirectory>${basedir}/src/main/webapp</sourceDirectory>
    <webappDirectory>${compressed-dir}</webappDirectory>
    <nosuffix>true</nosuffix>
    <nomunge>true</nomunge>
    <jswarn>false</jswarn>
    <!-- we keep the whole ext library in our src for nexus-webapp, we only need their single aggregated js file -->
    <!-- we also don't want to include any of our webapp launch scripts -->
    <excludes>
      <exclude>**/ext-2.2/**/*.js</exclude>
      <exclude>**/*.so</exclude>
      <exclude>**/*.dll</exclude>
      <exclude>**/*.jnilib</exclude>
      <exclude>**/*.exe</exclude>
      <exclude>**/*.a</exclude>
      <exclude>**/*.sl</exclude>
      <exclude>**/wrapper</exclude>
    </excludes>
    <aggregations>
      <aggregation>
        <!-- insert new line after each concatenation (default: false) -->
        <insertNewLine>true</insertNewLine>
      </aggregation>
    </aggregations>
  </configuration>
  <dependencies>
    <!-- we use specific version of plexus-utils, this dependency probably won't be needed for most folks -->
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>
</plugin>

And that’s pretty much it. If you have a javascript application that is getting bloated, use the YUI Compressor maven plugin to get your webapp loading within a reasonable time again.

Nexus Indexer API: Part 3


September 28, 2009 By Damian Bradicich

This series of Nexus Indexer posts focuses on integrating the Nexus Indexer into your own application. If you have an application that needs to search for an artifact by GAV coordinates, or by class name, you can use the Nexus Index format and the Nexus Indexer API to very easily search and locate artifacts in any repository that creates a Nexus Index. There are four main functions that are exposed in the Nexus Indexer API.

This post will focus on Packing indexes for supplying to consumers, and updating from other index providers Continue reading