Skip to content

Instantly share code, notes, and snippets.

@jitpack-io
Last active December 31, 2022 15:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jitpack-io/f928a858aa5da08ad9d9662f982da983 to your computer and use it in GitHub Desktop.
Save jitpack-io/f928a858aa5da08ad9d9662f982da983 to your computer and use it in GitHub Desktop.
Publish an existing jar file to jitpack
install:
- FILE="-Dfile=jars/my-library.jar"
- mvn install:install-file $FILE -DgroupId=com.github.user -DartifactId=repo -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true
@jitpack-io
Copy link
Author

jitpack-io commented Mar 26, 2019

For this to work the root directory also needs to have a pom.xml file:

<?xml version="1.0" encoding="iso-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
			    http://maven.apache.org/maven-v4_0_0.xsd">
	<groupId>com.github.user</groupId>
	<artifactId>repo</artifactId>
	<version>1.0</version>
</project>

@mpdude
Copy link

mpdude commented Apr 2, 2019

@jitpack-io Do I need to repeat this for all the .jars? Should they all share the same artifactId, or use a unique one for each jar?

@ozymand1as
Copy link

But what about .aars? Do I just need to change all instances of jar to aar?

@matyasforian
Copy link

dont you need mvn deploy to deploy things to a remote? mvn install installs it locally.

@JRWilding
Copy link

this appears to be a file you add to the root of your repo that reconfigures the jitpack build process to use this artifact instead (or as well as? not sure) of building one itself

@jitpack-io how do we dynamically define the version?

@hemanthkaipaa
Copy link

Always getting this erro.

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.hemanthkaipaa:sapostore:1.1.1.
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.github.hemanthkaipaa:sapostore:1.1.1.
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.github.hemanthkaipaa:sapostore:1.1.1.
Show Details
Affected Modules: app

@hemanthkaipaa
Copy link

hemanthkaipaa commented Jan 23, 2020

I have a dependency of 3rd party aar. I'm not aware how to deal with it.

@kekru
Copy link

kekru commented Jun 5, 2020

Isn't there any kind of authentication required?
Can everyone upload artifacts named with every github username?
This would be a huge security issue

@jitpack-io
Copy link
Author

@kekru the groupId and artifactId will be overwritten by JitPack at the time of build. If you put another username then the groupId will still be 'com.github.YourUsername'

@a914-gowtham
Copy link

a914-gowtham commented Mar 16, 2021

@jitpack-io I published an aar by following that example. but after I used the dependency url and I can't reach the classes that exist on the aar file. it doesn't even available in library folder

Screenshot from 2021-03-16 23-38-32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment