-
Create a local directory and set it up to serve jars:
mkdir -p ~/.m2-local/repository/ python -m SimpleHTTPServer 8000
-
Publish the jars to that location.
-
We use a (somewhat hacky) custom task called
pom_publish
but I assume you have a process../pants publish.jar
- maven
- whatever.
-
FWIW,
pom_publish
looks like this:./pants pom-publish --pom-publish-local='~/.m2-local/repository/' \ --no-pom-publish-dryrun --pom-publish-version='0.0.99999' path/to/your/target
-
A
pants publish.jar
might look like:./pants publish \ --publish-jar-override=com.foo#bar_2.10=0.0.8 \ --publish-jar-local=~/.m2-local/repository \ --no-publish-jar-dryrun \ --no-publish-jar-commit \ src/main/scala/com/foo/bar:target_name
-
One way or another, you need to see the jars under that directory:
- It must be in a directory structure that ivy understands:
- i.e.
~/.m2-local/repository/com/foo/bar/$rev/jar_name-rev.jar
- i.e.
- It must be in a directory structure that ivy understands:
-
-
Tell your
build-support/ivy/ivysettings.xml
where to look for the jars.-
Pants has
chain
repos in its ivysettings, which checks each resolver in order. This assumes you have a similar setup. -
To avoid confusion, you should make the local resolver the first listed.
<ibiblio name="localdev" m2compatible="true" usepoms="true" root="http://localhost:8000" pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
-
Note: this resolver may need to be adjusted to work with your publish semantics.
-
-
Edit the
rev
of the jar'sjar_library
definition (almost certainly under3rdparty
) to match the version you passed on the command line. -
Run your usual
pants
command to consume the jar.- Pants will use your jars as long as you:
- picked a unique version number
- remembered to start the server in the directory
- Have a
pattern
that matches your publish semantics
- Pants will use your jars as long as you:
-
Iterate as needed
-
Jar caching is very aggressive, so each time you rebuild the jar:
- Bump the
version
passed to pom-publish - update the
3rdparty
definition to match.
- Bump the
-
This is pretty odious to do over and over so try testing your jar as source as much as possible.