1 year ago
#388412
manish
maven error: Could not find artifact hosted in private github repository
Iam trying to pull an artifact hosted in github(company's private repo) but it is throwing an error:
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.my:package-order >-------------------------
[INFO] Building order 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from org-name-common-utility: https://github.com/{ORG-ID}/{REPO-NAME}/tree/mvn-repo/path/to/org-name-common-utility-1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/path/to/org-name-common-utility-1.0.pom
[WARNING] The POM for com.org.common-utility:org-name-common-utility:jar:1.0 is missing, no dependency information available
[WARNING] The artifact org.hibernate:hibernate-validator:jar:6.0.14.Final has been relocated to org.hibernate.validator:hibernate-validator:jar:6.0.14.Final
Downloading from org-name-common-utility: https://github.com/{ORG-ID}/{REPO-NAME}/tree/mvn-repo/path/to/org-name-common-utility-1.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/path/to/org-name-common-utility-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.171 s
[INFO] Finished at: 2022-04-07T21:31:01+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project package-order: Could not resolve dependencies for project com.org:package-order:jar:0.0.1-SNAPSHOT: Could not find artifact com.org.common-utility:org-name-common-utility:jar:1.0 in github (https://github.com/{ORG-ID}/{REPO-NAME}/tree/mvn-repo/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
my settings.xml
<settings>
<servers>
<server>
<id>github</id>
<password>MY-GITHUB-TOKEN</password>
</server>
</servers>
</settings>
added these lines in POM file of the project in which i want add the dependency(keeping same as id defined in server)
<repositories>
<repository>
<id>github</id>
<url>https://github.com/{ORG-ID}/{REPO-NAME}/tree/mvn-repo/</url>
</repository>
</repositories>
added dependency
<dependency>
<groupId>com.org.common-utility</groupId>
<artifactId>org-name-common-utility</artifactId>
<version>1.0</version>
</dependency>
NOTE: aritfact upload is working properly fine and binaries uploaded successfully to mvn-repo branch. followed this article: https://dev.to/iamthecarisma/hosting-a-maven-repository-on-github-site-maven-plugin-9ch
maven
github
pom.xml
maven-plugin
0 Answers
Your Answer