This summer at Terracotta, we’ve been pretty busy working on making our test and build infrastructure more convenient for the developers.
In fact, Ludovic, Louis and myself used some of our innovation days (days offered by Terracotta we can spend working on projects we want) to create (and contribute to) plugins for Nexus, Maven, and also for Jenkins (well, this last one was not developed during innovation days, but still, there it is !)
These plugins are really useful to us, and since we’ve made them open source (Apache 2 license ), here I am giving you a quick introduction to those plugins (source, binaries and docs , hoping they’ll help you too ! (and also hoping you’ll contribute to them if you like them ! )
They are hosted on Terracotta’s github account , follow their links to get more details about them.
Nexus plugins
If you want to know what are the dependencies of your project, or what depends on your project, your company repository manager is probably the best place to find out; after all, all the binaries are published there; that’s why we chose to develop / contribute to Nexus plugins :
- Nexus Dependency Management Plugin : a plugin to list the dependencies of a given artifact (and its parent) and also display some metadata such as SCM url, build url (think Jenkins job url) and the maven profiles enabled during the build; you can also use its optional maven plugin companion , the Maven Metadata Properties Plugin that publishes additional metadata in the pom before committing it to the tag, during release.
- Nexus Artifact Usage Plugin a plugin (from ebay, we mainly contributed to it to make it work with recent Nexus releases) to list the backward dependencies of an artifact; with that plugin you can visualize all the artifacts depending on a given artifact. The index is built in memory at start up and is updated at each new deployment
The Nexus Dependency Plugin functionality is very similar to Sonatype’s Nexus pro Maven Dependency plugin functionality; but the Nexus Dependency Plugin can not only list your artifacts compile dependencies, but also the provided, and test ones (telling you which scope is each dependency in) and can also give you the parent pom of the selected artifact. (and is open source )
Junit Categories Maven Plugin
This maven plugin lists all the Junit tests of a maven module (classes and methods) annotated with a @Category ; sorted by category names.
So for example, if you type in your terminal :
1 |
$ mvn clean test-compile org.terracotta.maven.plugins:junit-categories-maven-plugin:list |
, you should get something like :
1 2 3 4 5 6 7 8 9 10 11 12 |
[INFO] --- junit-categories-maven-plugin:1.0.0-SNAPSHOT:list (default-cli) @ my-sample-project --- [INFO] ****************************************** [INFO] * JUnit Categories found in test classes * [INFO] ****************************************** [INFO] ------------------------------------------ [INFO] | Category : org.terracotta.test.categories.FastTests | [INFO] ------------------------------------------ [INFO] org.terracotta.my.sample.project.OperationsTest.multiplyTest__fast [INFO] ------------------------------------------ [INFO] | Category : org.terracotta.test.categories.SlowTests | [INFO] ------------------------------------------ [INFO] org.terracotta.my.sample.project.OperationsTest.multiplyTest__slow |
Jenkins Accelerated Build Now plugin
When all Jenkins’ slaves are busy, wouldn’t you like to be able to launch the job you’re waiting after right now ? without adding it to a long queue ? without waiting for current jobs to complete ?
If your answer is yes, then the Accelerated Build Now plugin is for you !
The idea behind this plugin is that a user should not wait for automatically scheduled jobs to complete; his/her jobs should be the priority (and in the case the plugin needed to kill a running job scheduled automatically, it re schedules it).
The plugin code is hosted on Github, its binary is available directly from Jenkins update center (Jenkins-> Manage Jenkins -> Manage plugins) , and its wiki page is hosted on Jenkins Wiki
Bonus : Nexus plugins dev tips
Launch Nexus in debug mode
Open wrapper.conf :
1 |
$ vim NEXUS_HOME/bin/jsw/conf/wrapper.conf |
Uncomment some lines to have :
1 2 |
wrapper.java.additional.1=-Xdebug wrapper.java.additional.2=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
Then start nexus with :
1 |
$ bin/nexus console |
And attach your favourite IDE (in the workspace/ project with all the sources matching your nexus version) to port 8000
Test your plugin without deploying it to a local Nexus
It can be pretty boring to re deploy your built nexus plugin (
1 |
mvn clean package && unzip target/myplugin.zip NEXUSHOME/nexus/WEB-INF/plugin-repository |
) to test any change.
From the Nexus team chat room, I got the following tip :
Just add :
1 |
nexus.xml-plugin-repository=/Users/anthony/workspaces/nexus/nexus-dependency-management-plugin/load-in-nexus.xml |
to NEXUS_HOME/conf/nexus.properties , so that XmlNexusPluginRepository reloads your plugin at every save ! (provided you don’t change the methods signatures, in that case you will have to restart Nexus)