Return code is: 409, ReasonPhrase:Conflict (JCenter) - java

I have a artificact deployed in JCenter (oss.jfrog.org) although the deployment did not end without error (see Deploy SNAPSHOT to oss.jfrog.org (JCenter)), the jars are there when I check the Repository browser.
Now I add the dependency in a project for this artifact (library) and adding:
<repositories>
<!-- Release repository -->
<repository>
<id>oss-jfrog-artifactory-releases</id>
<name>oss-jfrog-artifactory-releases</name>
<url>http://oss.jfrog.org/artifactory/oss-release-local</url>
</repository>
<!-- Snapshot repository -->
<repository>
<id>oss-jfrog-artifactory-snapshots</id>
<name>oss-jfrog-artifactory-snapshots</name>
<url>http://oss.jfrog.org/artifactory/oss-snapshot-local</url>
</repository>
</repositories>
When maven started building, it throws this error:
Failed to transfer file: http://oss.jf
rog.org/artifactory/oss-release-local/com/myorg/mylibrary/0.0.1-SNAPSHOT/mylibrary-0.0.1-SNAPSHOT.pom. Return code is: 409, ReasonPhrase:Conflict. -> [Help 1]
for the dependency I added. What could be the problem here?

Try using the virtual repositories
<repositories>
<!-- Release repository -->
<repository>
<id>oss-jfrog-artifactory-releases</id>
<name>oss-jfrog-artifactory-releases</name>
<url>http://oss.jfrog.org/artifactory/libs-release</url>
</repository>
<!-- Snapshot repository -->
<repository>
<id>oss-jfrog-artifactory-snapshots</id>
<name>oss-jfrog-artifactory-snapshots</name>
<url>http://oss.jfrog.org/artifactory/libs-snapshot</url>
</repository>
</repositories>

I have a workaround. No idea why, but in my case adding shade plugin to all modules solved the problem, even an empty one:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<artifactSet>
</artifactSet>
<relocations>
</relocations>
</configuration>
</plugin>
</plugins>
</build>

Related

Maven compiler plugin Unsupported class file major version 60

I am updating a Spigot (Minecraft) plugin and the newest version of Spigot requires Java 16. In my pom I changed the maven compiler plugin target to 16 and the source is still 1.8. Now I am getting the following errors:
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project Plugin: Error creating shaded jar: Problem shading JAR C:\Users\Trent\workspace\Stocks\Plugin\target\Plugin-1.0-SNAPSHOT.jar entry com/tchristofferson/stocks/commands/StockbrokerCommand.class: java.lang.IllegalArgumentException: Unsupported class file major version 60
pom:
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>com.tchristofferson</groupId>
<artifactId>Stocks</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>API</module>
<module>Plugin</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>16</target>
<release>16</release>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
I had to use this before I could use 3.3.0-SNAPSHOT
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
#wemu was correct that the maven shade plugin doesn't yet support Java 16. To solve the issue I had to use a snapshot version of the maven shade plugin (3.3.0-SNAPSHOT) since 3.2.4 doesn't support Java 16 yet.
To elaborate on the answer #tchristofferson has given, I got it working by setting snapshots to true in my pluginRepository:
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
If you don't have the above in your pom.xml, just add it somewhere within <project></project>.
And then change the version of the maven-shade-plugin to this:
<version>3.3.0-SNAPSHOT</version>
In my case, the latest version of maven was installed on my machine, and code was intended for the java 11 version. So I have used an older version of maven and the error didn't appear.
FWIW...
You could also override the version of ASM, in order to make this work with maven-shade-plugin 3.2.x, like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.2</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>9.2</version>
</dependency>
</dependencies>
...
</plugin>
References:
https://issues.apache.org/jira/browse/MSHADE-407

How to download maven dependency as *.jar file?

I attempt to implement the example from here, but upon the Maven dependencies installation I can't find jar file amongst downloaded dependencies.
My pom.xml looks like this:
<?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>
<!-- This is often your domain name (reversed.) -->
<groupId>com.abc</groupId>
<!-- The name of this project (actually, the name of the artifact, which is the thing that this project produces. A jar in this case.) -->
<artifactId>javaparser-maven-sample</artifactId>
<!-- The version of this project. SNAPSHOT means "we're still working on it" -->
<version>1.0-SNAPSHOT</version>
<properties>
<!-- Tell Maven we want to use Java 8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Tell Maven to treat all source files as UTF-8 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>2.5.7</geotools.version>
</properties>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository> <!--Add the snapshot repository here-->
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>opengeo</id>
<name>OpenGeo Maven Repository</name>
<url>http://repo.opengeo.org</url>
</repository>
</repositories>
<dependencies>
<!-- Here are all your dependencies. Currently only one. These are automatically downloaded from https://mvnrepository.com/ -->
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.15.21</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mil.nga.geopackage/geopackage -->
<dependency>
<groupId>mil.nga.geopackage</groupId>
<artifactId>geopackage</artifactId>
<version>3.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.geotools/gt-api -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-api</artifactId>
<version>20.5</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.geotools/gt-geometry -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geometry</artifactId>
<version>2.5-M2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.geotools/gt-referencing -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.locationtech.jts.io/jts-io-common -->
<dependency>
<groupId>org.locationtech.jts.io</groupId>
<artifactId>jts-io-common</artifactId>
<version>1.16.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.opengis/geoapi -->
<dependency>
<groupId>org.opengis</groupId>
<artifactId>geoapi</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.geotools/gt-jts-wrapper -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jts-wrapper</artifactId>
<version>17.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>17.0</version>
</dependency>
</dependencies>
<!-- This blob of configuration tells Maven to make the jar executable. You can run it with:
mvn clean package
java -jar target/javaparser-maven-sample-1.0-SNAPSHOT-shaded.jar
-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.abc.conversion.LogicPositivizer</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am able to download all the jars except geotools related jars. When I clean and run the project, in the .m2 folder I am not able to see the geotool related jars. Even in the maven repository I am not able to download the jar file.
Maven repo
Is there any alternative way to proceed?
The repository run by Boundless has been replaced by one hosted by OSGeo. The OSGeo webdav repo was merged into the new OSGeo repo. Details are here (https://docs.geotools.org/latest/userguide/tutorial/quickstart/maven.html)
Replace this block
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository> <!--Add the snapshot repository here-->
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>opengeo</id>
<name>OpenGeo Maven Repository</name>
<url>http://repo.opengeo.org</url>
</repository>
with
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<repository>
<id>osgeo-snapshot</id>
<name>OSGeo Snapshot Repository</name>
<url>https://repo.osgeo.org/repository/snapshot/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
If you paste the Open Source Geospatial Foundation Repository URL in your web browser and hit enter it will return 404 Not Found error. This happens when Maven attempts to connect to that resource to fetch dependency for you but it's no longer available. However, if you pay close attention to Maven Repo link, there is a note:
Note: this artefact is located at Boundless repository (https://repo.boundlessgeo.com/main/)
Try to replace http://download.osgeo.org/webdav/geotools/ with a given in the note URL and run mvn clean install
Please let me know if that worked for you.

Maven can't resolve the Kotlin Maven Plugin jar

Not sure how to fix this.
I want this version of the Kotlin runtime and maven plugin.
These are the bits in my pom.xml:
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>
<version>1.2-M2</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.2-M2</version>
<executions>
And I added this as a repo:
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>kotlin-bintray</id>
<name>Kotlin Bintray</name>
<url>http://dl.bintray.com/kotlin/kotlin-dev/</url>
</repository>
I get this error:
Failure to find
org.jetbrains.kotlin:kotlin-maven-plugin:jar:1.2-M2 in
https://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are
forced
But I don't see anything that might be wrong.
By the way, notice that the runtime jar is found, so the repository section must be correct since this repository is where maven finds it. The maven plugin jar is a different matter for some reason though...
I just fixed. It was something really silly. I found out that for plugins one needs to define a plugin repository section.
<pluginRepositories>
<pluginRepository>
<id>kotlin-bintray</id>
<name>Kotlin Bintray</name>
<url>http://dl.bintray.com/kotlin/kotlin-dev</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
And now it works. I guess I should spend more time learning maven in depth :)
To make sure it downloads fresh from maven central you will need to blow away your local copy, so delete the directory:
~/.m2/repo/org/jetbrains/kotlin/kotlin-maven-plugin
You will also need to add the 3rd party repo to your settings.xml at ~/.m2 see here
<settings>
...
<profiles>
...
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>https://dl.bintray.com/kotlin/kotlin-dev/</url>
</repository>
</repositories>
</profile>
...
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
...
</settings>
At the documentation, we can see how to implement Compiler Plugins
For kotlin-allopen add the followin <configuration> and <pluginOptions> inside the <plugin> tag
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<configuration>
<compilerPlugins>
<!-- Or "spring" for the Spring support -->
<plugin>all-open</plugin>
</compilerPlugins>
<pluginOptions>
<!-- Each annotation is placed on its own line -->
<option>all-open:annotation=com.my.Annotation</option>
<option>all-open:annotation=com.their.AnotherAnnotation</option>
</pluginOptions>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
i just added this line and it worked for me
<version>${kotlin.version}</version>

Publishing Java Plugin to Repo error

I am trying to publish my plugin to the pluginrepository on OSS-SonaType. They have already provisioned my namespace for both snapshots and full releases. I am struggling to make my first initial commit to the repo. I can't seem to find the right Maven Configuration to push the plugin to the repo rather than trying to update the repo. Below find my pom.xml, and maven configuration code. Any help would be greatly appreciated!
Pom.xml:
<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>
<groupId>com.companynamehere.dmweb</groupId>
<artifactId>DMWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DMWeb</name>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.2.RELEASE</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>OSS-Repo</id>
<name>oss-repo</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Maven Config:
Goals: com.companynamehere:DMWeb:validate
Error:
Error resolving version for plugin 'com.companynamehere:DMWeb' from the repositories [local (C:\Users\kylec\.m2\repository), OSS-Repo (https://oss.sonatype.org/content/repositories/snapshots), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository -> [Help 1]

Qt Jambi Javadoc missing

When i fetched qt jambi jars from maven repository i found that there is no javadocs in it.
Downloading javadocs in maven didn't help.
My pom.xml:
<dependencies>
<dependency>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi</artifactId>
<version>4.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.sf.qtjambi</groupId>
<artifactId>qtjambi-maven-plugin</artifactId>
<configuration>
<!-- Specifies where sources are. This parameter is MANDATORY -->
<sourcesDir>src/main/java</sourcesDir>
<!-- following parameters aren't mandatory, they use defaults as specified
here if not specified <translationsDir>src/main/resources/translations</translationsDir>
<destinationDir>target/generated-sources/qtjambi</destinationDir> -->
<!-- cause -noobsolete switch for lupdate -->
<noObsoleteTranslations>true</noObsoleteTranslations>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>qtjambi</id>
<name>qtjambi</name>
<url>http://qtjambi.sourceforge.net/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>qtjambi</id>
<name>qtjambi</name>
<url>http://qtjambi.sourceforge.net/maven2/</url>
</pluginRepository>
</pluginRepositories>
I've tried to download jar manually, but there is still no javadoc in it.
http://repository.qt-jambi.org/nexus/content/repositories/releases-before-2011/net/sf/qtjambi/qtjambi-maven-plugin/4.6.3.1/ should contains qtjambi-maven-plugin-4.6.3.1-javadoc.jar. It's not there, so file a request at that project that they upload there javadocs as well.

Categories

Resources