Wiki

Clone wiki

Okapi / Using the Sources

Overview

(From @nmihai_2000)

The okapi *-sources.jar files are available now in the snapshot repository, and will start working in the release one after we release once.

The okapi artifacts are published here:

If you use okapi artifacts in your project, you already have a <repository> entry in your pom, and some Okapi <dependency>es.

There are no changes needed after we release Okapi. But if you want to access the sources now, you would need to point to the snapshot repository and depend on the 0.31-SNAPSHOT version of Okapi.

All you need to do is either run:

mvn dependency:sources

or in Eclipse right-click on the project, then "Maven > Download Sources" in the pop-up menu.

Maven: What I Did

The super-pom already had a spec for the maven-source-plugin, with settings and version. But that was just the "declaration", in <pluginManagement>

I have added it to the <plugins> section in super-pom to "activate" it.

But by default maven-source-plugin is invoked in the package phase, which comes a few steps before the install one. The result of that would have been that ALL modules built would have generated the *-sources.jar on mvn install, even for local builds.

That's just a waste of time (and disk space), so I wanted to disabled the generation.

My first try was to change the phase of the maven-source-plugin to deploy, which comes after install. But Jenkins does not use the standard maven deploy, uses its own thing, and mvn deploy is never invoked.

So I had to come with another way:

  1. Defined <maven.source.skip>true</maven.source.skip> in <properties>
  2. Changed the <skipSource> in the <configuration> of maven-source-plugin to use that property

So by default the source generation is disabled.

The way to enable it is to invoke maven with the maven.source.skip flag set to false:

mvn install -Dmaven.source.skip=false

You can do this on a local build, if you want.

The relevant submissions are on 2016-07-08 (152bd8b, ba22403) and 2016-06-26 (009fb94, 68344fe)

Jenkins: What I Did

The only change that was needed in Jenkins was to add that flag to the maven invocation for each build item ("<build_project> > Configure > Build > Goals and options"):

okapi

clean install -DskipITs  -q -U
clean install -Dmaven.source.skip=false -DskipITs  -q -U

okapi-snapshot

clean install -Prelease_or_snapshot -DskipITs
clean install -Prelease_or_snapshot -Dmaven.source.skip=false -DskipITs

okapi-release

clean install -DskipITs
clean install -Dmaven.source.skip=false -DskipITs

The okapi-release Jenkins project is modified, but does not generate sources because the super-pom in master is not changed.

Note

I have also tried to change the goal of the plugin from jar-no-fork to jar, hoping to improve performance. But this made Jenkins generate an error message: "Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo"

This is a known Jenkins issue: https://issues.jenkins-ci.org/browse/JENKINS-27372. When that is solved, we can try again.

Updated