Posts Tagged ‘Nexus’

develop jenkins plugin for redmine

Saturday, February 12th, 2011

Yesterday when I play with jenkins and redmine, I noticed it was little weak for current redmine plugin, so I decided to take a look at the source codes and build some compentence here.

Since I didn’t play with java codes for long time, I need to bring it back especially for maven knowledge.

To my surprise, jenkins’s documentation and its develop environment is excellent, see detail below

Getting started

image http://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial is the good start, and since mostly we use nexus, we need to follow http://wiki.jenkins-ci.org/display/JENKINS/HudsonWithNexus to configure the nexus server as well, yesterday I forget this ;-) , two tips you may need

  1. besides recommend setting for nexus user, the plugin group org.jvnet.hudson.tools needs to be set in settings.xml as well
  2. in nexus server, I added apache snapshot as well though it is not in the list, otherwise it complain to miss maven-enforcer-plugin:pom:1.1-snapshot

The guideline and the hudson maven plugin is excellent, which we can also learn for our own products

$ mvn -cpu hpi:create
$ cd create_samples
$ mvn package
$ mvn install
$ mvn hpi:run

image You can see during the package step, it will trigger the jetty server for smoke test, and after hpi:run command, I can visit my first jenkins plugin “UI Samples” for my browser.

so easy to start, this is also a reason the jenkins community is so big and lots of contribution since they have an excellent platform to work on.

Also this is a reason why almost every developers follow jenkins’s fork from hudson.

Play with redmine plugin

imageThis plugin is not moved to github yet, and I don’t know how to download via svn, anyway lastest source codes exist here https://svn.jenkins-ci.org/trunk/hudson/plugins/redmine/, I just use wget to download the source codes, sth like

wget "--accept=*" -l 7 -np -rL  --no-check-certificate https://svn.jenkins-ci.org/trunk/hudson/plugins/redmine/

Thanks to maven, I can simple use the same command to trigger it out, and to be fun, I just replace one icon to see whether it works, bingo, very good.

I will try to write some patches for our own usage.

Summary

- The jenkins development plugin is excellent on its code management using maven, since each plugin’s pom.xml is simple, it can let developer to focus its plugin business.

- mostly we need to develop own plugins in jenkins in the future to do integration.

Sonar help you to remove technical debt

Saturday, June 12th, 2010

From agile point of view, technical debt is a big topics especially after running agile/scrum for a while, team are used to leave technical debt into next iteration, not everyone want to decrease it, though agile coach mentioned/remind this. While with the one sonar plugin available, team will change their mind.

After successful deploy sonar (see posts Maven, Sonar with Nexus, so wierd), I started to install more useful plugins, you can see reference Code Quality Management Tool Sonar Provides Design and Architecture Metrics

Let’s start a real example below after I enabled the Technical Debt

image

From technical point of view, it is just another view from different quality metric (using different fomula), but the result is excellent, since when I show this to people, they quickly notice, “Ooh, this project cost lots to maintain (294$)

Forget to mention, deploy those plugins just needs “download, copy, restart”, no huge cost for integration.

more about Technical debt: http://thoughts.inphina.com/2010/04/03/dont-judge-an-application-by-looks/ 

As I said, CI and automation provides better feedback

All those plugins can be found http://docs.codehaus.org/display/SONAR/Sonar+Plugin+Library/

So my suggestion

- deploy SONAR first
- install technical debt plugins to track it.

Maven, Sonar with Nexus, so wierd

Friday, June 11th, 2010

I am struggling sonar these days.

maven, nexus, sonar are all less good documentation when problem happens, and Nexus is more tricky one when using it, though it is quite useful.

Several part are needed to take care, though from sonar document, you only need “mvn sonar:sonar”

Firstly in your project pom.xml, probably you need define sonar plugin version
   1: # project pom.xml
   2: <build>
   3:    <plugins>
   4:        <plugin>
   5:            <groupId>org.codehaus.mojo</groupId>
   6:            <artifactId>sonar-maven-plugin</artifactId>
   7:            <version>1.0-beta-1</version>
   8:        </plugin>
   9:    </plugins>
  10: ...

withoug this, you may get error below, see sonar discussion as well http://old.nabble.com/why-sonar-maven-plugin-not-part-of-server-maven-repository-bundle–td28070850.html

   1: ...
   2: Reason: Error getting POM for 'org.codehaus.mojo:sonar-maven-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
   3:   org.codehaus.mojo:sonar-maven-plugin:pom:2.0-SNAPSHOT

Secondly in your setting.xml, probably you need add extra setting

Mostly you will use nexus as repository manager, then we have two ways to configure in settings.xml, see http://docs.codehaus.org/display/SONAR/Full+installation+in+5+steps Either configure it in settings.xml or proxy the sonar server in nexus, I don’t make it work for first one, and the second one requires to set “!sonar” in mirrors as well, see http://jira.codehaus.org/browse/SONAR-1313, anyway in end, my settings.xml

   1: # ~/.m2/settings.xml 
   2: ..
   3:   <mirror>
   4:     <id>nexus</id>
   5:     <mirrorOf>*,!sonar</mirrorOf>
   6:     <name>Nexus</name>
   7:     <url>http://192.168.56.191:9081/nexus/content/groups/public</url>
   8:   </mirror>
   9: </mirrors>
  10: ...
  11:   <profile>
  12:      <id>sonar</id>
  13:      <activation>
  14:        <activeByDefault>true</activeByDefault>
  15:       </activation>
  16:       <properties>
  17:         <sonar.host.url>http://192.168.56.191:9000</sonar.host.url>
  18:       </properties>
  19:     </profile>
  20:   </profiles>
  21: ...

There are other tips

   1: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
   2: POM 'org.codehaus.sonar:sonar-maven-plugin' not found in repository: Unable to download the artifact from any repository

If you meet this, maybe remove /org/codehaus/mojo in your local repository http://docs.codehaus.org/display/SONAR/Install+Sonar

The most of maven plugin for sonar exist in sonar server, but you can’t access via browser for http://192.168.56.191:9000/deploy/maven , but you can go to that directory directly $SONAR_HOME/war/sonar-server/deploy/maven/org

My friend also told me better use rename to sonar insteaf of sonar-2.1.2 for the directly.

see final result below

image

Sonar works is just the beginning, I will look into more plugins like http://www.infoq.com/news/2010/06/sonar-2.1 , which surely be a dedicated post

agile development skills – thinking from Certified Scrum Developer

Monday, June 7th, 2010

In ScrumGathering 2010, I heard the Certified Scrum Developer program http://www.scrumalliance.org/CSD from ScrumAlliance, and below is the feedback for the first CSD course http://dnicolet1.tripod.com/agile/index.blog?entry_id=2020614, see more @infoq Reactions to the First Certified Scrum Developer Course

It is interesting topic to me, since when I give the introduction to the designers for agile, most of them wants to know more practical ways to go forward after playing with agile for a while (like 6 months).

Tools matters for agile for agile development

image While in the company, most of java designers had no time to look deeper in those areas, and used to use old tool, which cause low efficiency.

And also for those C++ (or other old company language) designers, when they start to deploy agile, they face more challenges, I’d like give them chance to see how those problems are solved in java world, then it can give them new ideas, most of core concepts are not language related, while when start the agile journal, we all notice java is much easier to let designers to start agile.

If I have time, I want to create 5days (40hours) training to cover this area

day 1: establish the agile environment: version control (svn), maven, hudson CI , eclipse. nexus
day 2: TDD, junit with coverage
day 3: TDD, quality control : PMD, FindBugs, coverage, SONAR
day 4: collaboration with mylyn (trac), frequent release, package: maven respository more
day 5: ???

When using most efficiency tools, I try to introduce those TDD, CI, Refactory… agile practices.

How do you think about it ?