Deploying Java Application to Heroku Results in jackson-mapper-asl Maven Error - maven

The exact maven error message when deploying to heroku is:
No versions available for org.codehaus.jackson:jackson-mapper-asl:jar:[1.9,1.9.9] within specified range
I believe the issue is related to this answer and this Jackson repository maven-metadata.xml bug.
The following entry in the maven deploy log indicates that jackson-mapper-asl 1.9.9 is being downloaded from a heroku maven repository:
Downloaded: http://s3pository.heroku.com/jvm/org/codehaus/jackson/jackson-mapper-asl/1.9.9/jackson-mapper-asl-1.9.9.pom (2 KB at 12.3 KB/sec)
The heroku versions of the jackson maven-metadata.xml files are using incorrect version numbers - causing the maven error when using version ranges.
Is there a way, at deployment, to tell heroku to use a different maven repository for this dependency? Better yet, is there a way to get the heroku jackson-mapper-asl maven-metadata.xml file fixed?

Could this suffice as a workaround? You could just take the repository configuration section and point to somewhere else or supplying the file yourself as you would do with custom items.
Anyway, you can do it. Defining a regular repository in pom.xml, here the central one:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Defining a repository in pom.xml that is pointing to a local "repo" item, which exists only within the application deployment:
<repositories>
<!--other repositories if any-->
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
You should contact Heroku support about this in any case.

Follow Up I contacted Heroku support (super helpful, BTW) and they discovered the Heroku Maven cache was invalid for more than just Jackson. Heroku support kicked off an update process that helped resolve the problem but did not fix it completely. To get this issue completely resolved I had to add an explicit dependency to jackson-mapper-asl 1.9.9 in my pom.xml before I could deploy my app to Heroku.

Related

OSE v3 connection timeout to maven repo while building maven project

we are getting connection timeout error while building maven project.some can please help us on this issue.same project is working on osev2.
When you had this kind of problems, check out which repositories contains the requested artifact. In this case as you can see in the link below, 3 repositories contains it. Add one of to your repositories/pluginRepositories section of your pom.xml.
Since this is a plugin you should add it as plugin repository.
<pluginRepositories>
....
<pluginRepository>
<id>central</id>
<name>maven central</name>
<url>http://central.maven.org/maven2/</url>
</pluginRepository>
</pluginRepositories>
Also 2.5 is a fairly old version, there is a newer 3.0.2 version (I would recommend changing it to this).
https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5

Maven repository for camunda 1.4.0-SNAPSHOT

I'm following some instructions here on how to get started with a Spring Boot Camunda start up application.
https://camunda.github.io/camunda-bpm-spring-boot-starter/docs/current/index.html
According to this link I should be able to find 2.0.0-SNAPSHOT on Maven central but I cannot.
https://github.com/camunda/camunda-bpm-spring-boot-starter
Maven central only has version 1.3.0.
https://mvnrepository.com/artifact/org.camunda.bpm.extension/camunda-bpm-spring-boot-starter
Can someone help me with this. At the moment the only way I can get things working is by building the whole camunda-bpm-spring-boot project that I downloaded from GitHub.
To use Camunda SpringBoot 2.0.0-SNAPSHOT, you have to add the maven central snapshot repository to your project like so
<repository>
<id>maven-central-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
See here for the artifacts of 2.0.0-SNAPSHOT. You don't find them under the old location because the groupId and artifactIds changed a bit. Also there is no actual 2.0.0 release yet.

Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host)

I am trying to build my project but I get this:
Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.0.M3 from/to spring-snapshots (http://repo.spring.io/snapshot): repo.spring.io and 'parent.relativePath' points at no local POM # line 16, column 10: Unknown host repo.spring.io -> [Help 2]
Here is how I specify the parent of my pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.M3</version>
<relativePath></relativePath>
</parent>
The is empty so that it forces maven to look for the parent in the remote repository. However, it says that repo.spring.io is an unknown host.
Here is how I define the repositories in my pom.xml:
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
Any ideas?
Obviously it's a problem with your internet connection. Check, if you can reach http://repo.spring.io with your browser. If yes, check if you need to configure a proxy server. If no, you should contact your internet provider.
Here is the documentation, how you configure a proxy server for Maven: https://maven.apache.org/guides/mini/guide-proxies.html
For anyone stumbling upon this question, I'll post the solution to a similar problem (same error message except for the uknown host part).
Since January 15, 2020 maven central no longer supports HTTP, in favour of HTTPS.
Consequently, spring repositories switched to HTTPS as well
The solution is therefore to change the urls from http://repo.spring.io/milestone to https://repo.spring.io/milestone.
The issue is with your project which is not able to complete maven build.
Steps to follow :
Right Click Application and RunAs maven install.
If you get any error while reaching the repos online try giving the proxies in settings.xml under your .m2 directory.Check this link for setting proxies for maven build.
Once done , try doing a Update Project by Right Click Project , Maven->Update Maven Project and select codebase and do check the Force Update of Snapshot/Release check box.
This will update your maven build and will surely remove your errors with pom.xml
Project->maven->Update Project->tick all checkboxes expect offline and error is solved soon.
Rigth button on your project -> Maven -> Update
In my case the problem was with the java version mismatch of pom.xml (java 1.8) and environment variables JAVA_HOME/JDK_HOME (java 1.7). After pointing environment variables JAVA_HOME & JDK_HOME to Java 1.8, the issue got resolved.
If all above stuffs not works. try this.
If you are using IntelliJ. Check below setting:
May be ~/.m2/settings.xml is restricting to connect to internet.
If you're using docker-machine (docker on Windows or OSX).
Currently docker-machine has a bug that it loses internet connection if you switch between wifi networks or wifi and cable.
Make sure you restart your docker-machine
usually: docker-machine restart default
Just a remind: I tried to work with idea and imported maven, and encountered the same problem, I have tried all the solutions and they didnt work. Finally, I found out it was because of the root access... I opened idea with administrator access and all things work just fine, hope you not as silly as i am...
This worked for me!
Try navigating to the Maven tab and then click on install.
After finishing, again try to resolve dependencies.
If you are using docker service and you have switched to other network. You need to restart docker service.
service docker restart
This solved my problem in docker.
Just right click on pom.xml > maven > update maven project > check the force update of Snapshots/Releases
After the error "Non-resolvable parent POM: Could not transfer artifact etc.",
I found out that I indeed had to configure a proxy server.
However, in spite of restarts etc., the error only disappeared after doing:
mvn dependency:purge-local-repository
Guess this has to do with re-resolving dependencies:
Apache documentation about purging local repository dependencies
I was facing the same issue. The reason was the Internet connection. It was resolved when I changed ISP.
Downgrade your version
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version><change this version></version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Build and undo the version, Build.
2.1.6.RELEASE to 1.3.3.RELEASE Build
Undo
1.3.3 to 2.1.6 Build (in my case problem solved)
It helped us.
As people already mentioned, it could be internet problems or proxy configuration.
I found this question when I was searching about the same problem. In my case, it was proxy configuration.Answers posted here didn't solve my issue, because every link suggest a configuration that shows the username and passoword and I can't use it.
I was searching about it elsewere and I found a configuration to be made on settings.xml, I needed to make some changes. Here is the final code:
<profiles>
<profile>
<id>MavenRepository</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>MavenRepository</activeProfile>
</activeProfiles>
I hope be useful.
In the pom.xml (after loading effective pom.xml in eclipse), you may see it "http://repo.maven.apache.org/maven2" under central repository instead of "https://repo.maven.apache.org/maven2". Fix it

Maven: Error resolving version for plugin

I am trying to get Batik working, having not worked with Java much in the last ten years or so and I'm running into problems with Maven being able to find the org.apache.maven.wagon:wagon-ssh-external package.
When I open or try to build the project in Netbeans, it reports the following error:
The project org.freehep:freehep-graphicsio:2.1.1 (/home/glenatron/Projects/batik/freehep-graphicsio/pom.xml) has 1 error
Unresolveable build extension:
Error resolving version for plugin 'org.apache.maven.wagon:wagon-ssh-external' from the repositories [local (/home/glenatron/.m2/repository), freehep-maven (http://java.freehep.org/maven2), central (http://www.ibiblio.org/maven2), Codehaus (http://repository.codehaus.org/), Codehaus Snapshots (http://snapshots.repository.codehaus.org/)]:
Plugin not found in any plugin repository -> [Help 2]
As far as I can tell this is correct, however, I have the following in my pom.xml file for the project:
<repositories>
<repository>
<id>freehep-maven</id>
<name>Maven FreeHEP</name>
<url>http://java.freehep.org/maven2</url>
</repository>
<repository>
<id>maven-apache</id>
<name>Maven Apache</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>maven1</id>
<name>Maven.org</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
From what I can judge a) that plugin should be available in one of those repositories and b) if they are in the pom.xml file, Maven should be searching them but I can't see any sign of it doing that.
The project I am trying to work with is the FreeHEP EMF driver. The bigger screen solution was to use the unsignposted but much more up to date Github repository version.
It turns out that the solution was in the message after all: Error resolving version for plugin.
So obviously it's not a repository it is a pluginRepository which goes in a different part of pom.xml:
<pluginRepositories>
<pluginRepository>
<id>maven1</id>
<name>Maven.org</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
Remove the entries with repo1... cause this is maven Central and used by Maven by default so no need to define it explicit. Furthermore the given freehep.org is also available via Maven Central. So if i see it correct you don't need to define supplemental repositories at all.

Is it possible for maven to not search snapshots in release repositories?

I've discovered today, while investigating a bug regarding my project being no more deployable, that maven tries to load dependencies from all available repositories.
I don't find it wise, specifically regarding our internal artifacts, that are searched on amven central, Sonatype FlexMojos, and other external release repositories (specificall when the last one provides a custom 404 page that maven wrongly interprets as valid content, replacing my valid artifact with an invalid one).
So, is is possible to tell maven which repositories to lookup for SNAPSHOTs artifacts, and which to lookup for RELEASE ones ?
Would it help if you made it explicit to not look for snapshots in your repo?
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
My solution is to set up a repository mirror in the intranet. That way, Maven needs to know a single URL to download everything.
I then use the internal mirror to bundle repositories (local and remote ones). If snapshot repos are first in the search path, the mirror server will almost never publish the names of my internal artifacts (only when I forgot to deploy them).
On top of that, it will reduce the download times for the rest of the team plus it will make sure that everyone can still work even when there are network problems outside of your control.

Resources