Skip to content

Instantly share code, notes, and snippets.

@alexishida
Created November 29, 2018 16:43
Show Gist options
  • Select an option

  • Save alexishida/ec2880412efe72f503092b8dd7ae848b to your computer and use it in GitHub Desktop.

Select an option

Save alexishida/ec2880412efe72f503092b8dd7ae848b to your computer and use it in GitHub Desktop.
Add Local jar in maven
Simple ways to add and work with a `.jar` file in your local maven setup
# Add to project as system scoped file
As a short term tactic, I have also added the .jar as a system scoped file.
I did this in the past when working with a ‘bug fix’ version of Selenium WebDriver that had not yet propagated through to maven central, but which was available for download.
<dependency>
<groupId>selenium_2_53_1</groupId>
<artifactId>com.seleniumhq.selenium_2_53_1 </artifactId>
<version>2.53.1</version>
<scope>system</scope>
<systemPath>
C:/Users/Alan/Downloads/selenium-2.53.1/selenium-server-standalone-2.53.1.jar
</systemPath>
</dependency>
# Install .jar locally to your .m2 repository
mvn install:install-file \
-Dfile=target/restmud-engine-1.4-SNAPSHOT-jar-with-dependencies.jar \
-DpomFile=pom.xml
If I didn’t have the pom.xml file, I could still do this, I just add the details from the pom.xml into my command line:
mvn install:install-file \
-Dfile=target/restmud-engine-1.4-SNAPSHOT-jar-with-dependencies.jar \
-DgroupId=uk.co.compendiumdev \
-DartifactId=restmud-engine \
-Dversion=1.4-SNAPSHOT \
-Dpackaging=jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment