mvn install:install-file -Dfile=/absolute/path/to/your-library.jar -DgroupId=com.yourcompany -DartifactId=your-library -Dversion=1.0.0 -Dpackaging=jar
After installation, add the dependency to your pom.xml:
<dependency>
<groupId>com.yourcompany</groupId>
<artifactId>your-library</artifactId>
<version>1.0.0</version>
</dependency>
As an alternative, you can reference the JAR directly from your file system. This avoids forcing every developer and CI server to run the install command each time a local JAR is added.
Take a look at the following blog post for a detailed guide:
Using a local JAR without installing it manually
I ran into a problem specifying the variable on Windows. It seems there's a problem with how maven parses commands containing special characters. So far I've tried double/single quotes to no avail. I figure I'll just have to shuffle the jar around until I get it into Mavens preferred path.
ReplyDelete