Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

Every once in a while, you have a library that isn’t in a repository and shouldn’t be there for some reason. We had such a library. How do you use that library when it is on your local system instead of in a repository? Use the system scope.

<dependency>
      <groupId>com.this.and.that</groupId>
      <artifactId>non-repo-library</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>/my/path/to/lib.jar</systemPath>
    </dependency>

System scope tells Maven that the dependency is on the file system. System Path tells Maven where to find the dependency.

December 10th, 2014

Posted In: Maven

Tags: , , , ,

Leave a Comment

You would think that this would be terribly easy, but it isn’t. It took several attempts before I figured out what they wanted. Too bad their contextual help doesn’t give you the details.

Select the “Deploy” tab from the top, then select the “Artifacts Bundle” tab from the left. Choose the file you want, then hit deploy.

The tricky part is that they expect very specific things from the file. In my case, I was trying to import the artifact corresponding to

<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjtools</artifactId>
    <version>1.6.11</version>
</dependency>

What they don’t tell you is that the name of the file will be part of the groupId. So I ended up with an archive named org.zip. The contents of the archive were:
/aspectj
     /aspectjtools
          /1.6.11
               aspectjtools-1.6.11.jar
               aspectjtools-1.6.11.jar.sha1
               aspectjtools-1.6.11.pom
               aspectjtools-1.6.11.pom.sha1

In hindsight, I might have been able to name the archive org.aspectj.aspectjtools, then inside I could have multiple version directories, each containing their respective artifacts.

January 17th, 2013

Posted In: Maven

Tags: , , , ,

Leave a Comment

LinkedIn Auto Publish Powered By : XYZScripts.com