I want to use a package named sourcemap in my project. It's not available in maven central, but in Atlassian's public maven repository. I therefore set up my pom.xml like this:
<repositories>
<repository>
<id>atlassian</id>
<name>Atlassian</name>
<url>https://packages.atlassian.com/content/repositories/atlassian-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.atlassian.sourcemap</groupId>
<artifactId>sourcemap</artifactId>
<version>1.7.7</version>
</dependency>
</dependencies>
Now, the POM file for sourcemap references another POM file from a package named public-pom:
<!-- POM for sourcemap (NOT my pom.xml!) -->
<parent>
<groupId>com.atlassian.pom</groupId>
<artifactId>public-pom</artifactId>
<version>3.0.84</version>
</parent>
The problem: the POM file references version 3.0.84 of public-pom, but Atlassian's repo no longer provides 3.0.84. Currently, the oldest available version of public-pom is 5.0.0, as you can see here. Because of this, maven complains when I attempt to build the project:
Could not find artifact com.atlassian.pom:public-pom:pom:3.0.84 in atlassian (https://packages.atlassian.com/content/repositories/atlassian-public/)
How can I fix the POM and use this package in my project?
Mvnrepository lists com.atlassian.pom:public-pom:pom:3.0.84 but when selecting the link to it:
status: 404
message: "Could not find resource"
Related
I am trying to add a dependency to my pom.xml and facing an issue: IntelliJ error
Cannot resolve jfugue:jfugue:5.0.9
The dependency I like to add is this one below from https://mvnrepository.com/artifact/jfugue/jfugue/5.0.9
<!-- https://mvnrepository.com/artifact/jfugue/jfugue -->
<dependency>
<groupId>jfugue</groupId>
<artifactId>jfugue</artifactId>
<version>5.0.9</version>
</dependency>
I have no problems adding other dependencies just by adding the xml-snippet from maven into my pom and refresh or reload all maven projects. For example I have this dependency in the same pom which is working fine:
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
However, there is a note under the snippet which one can copy-paste, https://mvnrepository.com/artifact/jfugue/jfugue/5.0.9
Note: this artifact is located at SingGroup repository (https://maven.sing-group.org/repository/maven/)
What do I need to add to the pom so that I can use that dependency in my Project and get rid of the error?
Cannot resolve jfugue:jfugue:5.0.9
Thanks in advance.
You can add the repository to your settings.xml Maven Guide
<profiles>
<profile>
<id>multi-repo</id>
<repositories>
<repository>
<id>MavenCentral</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
<repository>
<id>MavenSing</id>
<url>https://maven.sing-group.org/repository/maven//</url>
</repository>
</repositories>
</profile>
</profiles>
This Lib is no longer on the Maven repo. I get same result when adding the dependency to my project's POM file. You can get the JAR file from this URL and then include it into your project's class path:
http://www.jfugue.org/download.html
Consider I have a maven plugin project and I want to publish it to Github's public maven repository called "Github Packages". I've done everything by instruction and for normal projects everything works fine out of the box. But for maven plugin projects with packaging=maven-plugin the instruction doesn't work.
In build log I see something like this:
[WARNING] Could not transfer metadata repo-name/maven-metadata.xml
from/to github (https://maven.pkg.github.com/user-name/repo-name):
Failed to transfer file:
https://maven.pkg.github.com/user-name/repo-name/group-id/maven-metadata.xml.
Return code is: 422 , ReasonPhrase:Unprocessable Entity.
It seems the maven deploy plugin needs maven-metadata.xml in the group-id's root, but can't find it and no one puts it there. How to solve this problem?
I use Apache Maven 3.3.9, and use the command:
mvn clean deploy
--Addition: example of pom file I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub my_repo Apache Maven Packages</name>
<url>https://maven.pkg.github.com/my_nick/my_repo</url>
</repository>
</repositories>
<version>1.0.0</version>
<groupId>x</groupId>
<artifactId>some-plugin</artifactId>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>x</groupId>
<artifactId>my-dependency</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.15.12</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
</plugin>
</plugins>
</build>
</project>
Unfortunately I haven't found the right answer to my question, it seems that for now it's impossible to add Maven plugins to Github Packages.
However I found a workaround which uses S3 as a repository backend, so you don't need heavyweight solutions like Nexus or JFrog. You can read this and this on how to do it.
I had the same problem 422 from server: Unprocessable Entity when publishing Maven artifacts from GitHub Actions to GitHub Packages. The reason was that the corresponding tag for the uploaded artifact didn't exist yet.
The error message may be better in this case.
If you have already uploaded the artifact to the GitHub Packages then it means you have configured everything right.
I suppose the real reason for the 422 error is that you are trying to upload the same artifact with the same version that already was uploaded. And if it is not a SNAPSHOT version then the repository should deny replacing it so it behaves correctly.
I got the same error when trying to redeploy the already deployed package:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MavenPluginForGithub:
Failed to deploy artifacts: Could not transfer artifact ru.dmochalov:SampleMavenPluginForGithub:jar:1.0.3 from/to github (https://maven.pkg.github.com/dmochalov/hello-world):
Failed to transfer file: https://maven.pkg.github.com/dmochalov/hello-world/ru/dmochalov/SampleMavenPluginForGithub/1.0.3/SampleMavenPluginForGithub-1.0.3.jar.
Return code is: 422, ReasonPhrase: Unprocessable Entity. -> [Help 1]
How to fix?
Is suppose you have two options:
Increment the version <version>1.0.0</version> of the plugin from 1.0.0 to 1.0.1. Consider using 1.0.1-SNAPSHOT versions if the plugin is unstable and under development. GitHub allows redeploying artifacts with SNAPSHOT versions. So you could always redeploy it when developing.
Delete the package from the repo. You can do it only for packages in a private repository.
422 error vs 401 error
I suppose that there is not accepted specification or standardization for error codes and different repositories behave differently. For example, the Maven Central repository replies with 401 error when attempting to replace the already deployed version.
Why GitHub decided to use 422 is a mystery. There is an answer in the community forum but without proper explanation.
Here's the official github link for how to do exactly that. However, since this doesn't seem to be of much help, here's a link to a gradle forum question that should help you with this. Best of luck!
I am trying to create a graphql client in Java project and I am using apollographql library. The problem is that I am not able to get the dependencies using the pom.xml with version different than from Central repository. The other thing is that all of the examples are built with Gradle.
Do you have any examples or ideas about how to create a simple subscription client using apollo library and maven project? One of the specific issues that I have is that once apollographql-runtime library is downloaded there is no "subscription" package.
I wanted to use this dependency:
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
</dependency>
but I am not able to download it using pom.xml.
In a different project, it was working with gradle.build file.
tried download .jar file but still no "subscription" package available.
pom.xml
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
<type>pom</type>
</dependency>
I want to import this class:
import com.apollographql.apollo.subscription.WebSocketSubscriptionTransport;
Could not resolve dependencies for project com.brzozaxd.rbpvendor2:rbpvendor2:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.apollographql.apollo:apollo-api:jar:1.0.0-alpha5
Works for me, and has the mentioned package and class inside it.
<project>
....
<repositories>
<repository>
<id>repo2</id>
<name>appolographql repo</name>
<url>https://dl.bintray.com/apollographql/android</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
</dependency>
</dependencies>
</project>
I am using maven to add dependency. I added
<!-- https://mvnrepository.com/artifact/org.jboss.seam/jboss-seam -->
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>2.3.5.Final-redhat-1</version>
</dependency>
jboss-seam jar by using above lines in pom.xml. When I run mvn clean install it gives an error
What is the issue and how to solve this error?
Try adding the below repository in your pom file,
<repositories>
<repository>
<id>redhat</id>
<url>https://maven.repository.redhat.com/ga/</url>
</repository>
</repositories>
The artifact is not available in maven central repository. Its available only in redhat-ga repository.
I have some local jar files in a folder /src/main/resources/foobar under my basepath.
I have them included as dependencies in my POM.xml:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.4-SNAPSHOT</version>
</dependency>
Now i tried to add them with a local repository:
<repositories>
<repository>
<id>resource-repository</id>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
Now still i get the error message that the jars inside this reposirtory not found:
The following artifacts could not be resolved: bar... in file://.../repo was cached in the local repository, resolution will not be reattempted until the update interval of resource-repository has elapsed or updates are forced -> [Help 1]
I have not used the
mvn install:install-file
command for this. And i would be happy if there is a solution where i dont need to do this.
Edit:
The folder structure is:
repo\io\swagger\swagger-models\1.5.4-SNAPSHOT
and Jar inside:
swagger-models-1.5.4-SNAPSHOT.Jar
Funny though i get a warning about a missing POM from this file when running maven install.
You can declare a Repository for your third party dependencies.
The dependencies must be placed inside the repoBase path and the directory for the jar must follow the pattern: "{groupId}/{artifactId}/{artifactVersion}". Inside this folder the jar has to be named "{artifactId}-{artifactVersion}.jar".
Example:
<dependencies>
<dependency>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>resource-repository</id>
<url>file:${project.basedir}/repo</url>
</repository>
I have this in my pom (and of course the project-tag and group-id etc.)
I then have a directory repo in my project-directory.
In the path "repo\foo\bar\1.0" i then have a "bar-1.0.jar" file inside this directory. This compiles for me (ok, the jar is empty but this does not matter for an example).
Please note that the url for the repository does not contain the two slashes after the "file:".
I hope this example is a little bit more understandable for anyone who tries to this.
I suggest you to use system tag in your dependency tag. Hope it will work.