maven.elasticsearch.org returning a 404 - maven

We are running into an issue with our Maven dependency on the Elastic Search Libraries that our code depends on in order to build / compile.
The build process fetched these libraries at build time, however the maven elastic search repository seems to be off line all together.
http://maven.elasticsearch.org/ currently returns a 404 resulting in everything below it being unavailable which results in the build process failing.
Even the maven central repo for elastic shield returns 404's https://repo.maven.apache.org/maven2/org/elasticsearch/plugin/shield/
I have sent an email to support#elastic.co asking them to turn the Elastic Repo back on, any other idea why this repo would just go offline and how would I go about rectifying it? A local onsite mirror of central, but it feels like overkill for what we need it for.

From the official document here
The repository URL is : https://artifacts.elastic.co/maven/org/elasticsearch/plugin/shield/2.4.6/shield-2.4.6.jar
If you are using maven:
<project ...>
<repositories>
<!-- add the elasticsearch repo -->
<repository>
<id>elasticsearch-releases</id>
<url>https://artifacts.elastic.co/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
...
</repositories>
...
<dependencies>
<!-- add the shield jar as a dependency -->
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>shield</artifactId>
<version>2.4.6</version>
</dependency>
...
</dependencies>
...
</project>

Related

Repository Version Policy : ignore missing poms?

Having looked at this some more I realise
The thing that confuses me is that maven is searching the repo for this file and not finding it. I don’t understand why a different local repo (one of 6 listed repos in the POM file) should be a problem.
My assumption is that the problem comes in the Version Policy of the repository being Release. This is surely what the error implies but the old repository also had a policy of release and anyway I’m not storing the snapshot on there is is only looking for it as it is the dependency of a dependency stored on Maven Central that isn’t found.
Is there a way I can either change the policy to allow it to be searched for snapshots or stop maven from searching this repo for snapshots ?
We have moved our internal repo from on server to another and upgraded it to 3.12.1-01 from 2.14.9-01.
We have migrated the artifacts over using the agent. I have built a couple of simple projects using the new repo and all seems well.
However on one app I am getting this error
[INFO] ------------------------------------------------------------------------
Downloading: http://reposerver:8081/repository/releases/org/glassfish/javax.el/3.0.1-b06-SNAPSHOT/javax.el-3.0.1-b06-SNAPSHOT.pom
Downloading: http://reposerver:8081/repository/releases/org/glassfish/javax.el/3.0.1-b07-SNAPSHOT/javax.el-3.0.1-b07-SNAPSHOT.pom
Downloading: http://reposerver:8081/repository/releases/org/glassfish/javax.el/3.0.1-b08-SNAPSHOT/javax.el-3.0.1-b08-SNAPSHOT.pom
...
[INFO] -----------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project :
Could not resolve dependencies for project :
Failed to collect dependencies at org.eclipse.jetty:jetty-
jsp:jar:9.2.19.v20160908 -> org.glassfish.web:javax.servlet.jsp:jar:2.3.2 ->
org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT:
Failed to read artifact descriptor for org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT:
Could not transfer artifact org.glassfish:javax.el:pom:3.0.1-b06-SNAPSHOT from/to releases.new
(http://reposerver:8081/repository/releases/): Failed to transfer file:
http://reposerver:8081/repository/releases/org/glassfish/javax.el/3.0.1-b06-SNAPSHOT/javax.el-3.0.1-b06-SNAPSHOT.pom.
Return code is: 400 , ReasonPhrase:Repository version policy: RELEASE does
not allow version: 3.0.1-b06-SNAPSHOT. -> [Help 1]
If I point back to the old repo I don't have a problem at all. I had a quick go trying to change jetty versions and exclude javax.el to just avoid using the snapshot dependency and get the project to build but I can't seem to easily do this without causing catastrophic build failures.
Checking again I have missed this ongoing warning when using the old repositorty
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b07-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b08-SNAPSHOT is missing, no dependency information available
I have tried adding this repo which seems to have the snapshot
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
but this makes no difference.
As I understand it maven is trying all repos to recursively find all dependencies and as my local repo is last it is reporting the error after checking my local repo. The error about snapshot policies is a false message and the issue is it can't find the POM for the javax-el jar and so can't continue looking for dependencies. I don't understand why it iognores after looking at one repo and fails when it is instructed to look at another ?
The only difference between success an failure at my end is
Success:
<repository>
<id>releases</id>
<name>App Repository</name>
<url>http://oldserver:8081/repository/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>snapshots</id>
<name>App Repository</name>
<url>http://newserver:8081/repository/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
FAILURE
<repository>
<id>releases</id>
<name>App Repository</name>
<url>http://newserver:8081/repository/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>snapshots</id>
<name>App Repository</name>
<url>http://newserver:8081/repository/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Is this a setting on the new nexus repository ? At the moment I'm hoping for a simple like for like fix but if you think I need to change the dependencies I'm calling then that's fine
Jetty dependencies called
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.0.6.v20130930</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<version>9.2.19.v20160908</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>9.2.19.v20160908</version>
</dependency>
Okay I haven't found an answer for why the versions of Nexus seem to act differently (this my be my misunderstanding of the root cause!)
I have fixed it with a simple pom mod (which I thought I had tried before but I must have gone round in some silly circles)
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>9.2.19.v20160908</version>
<exclusions>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish/javax.el -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
</dependency>

using a private github repository to host a private maven artifact

Question title kind of explains it all. I've seen other questions referencing this but I think they are more geared towards the github repository being public. Using this configuration in the dependent project works when the repository is public:
<repositories>
<repository>
<id>company-core-mvn-repo</id>
<url>https://raw.github.com/company/company-core/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.company.core</groupId>
<artifactId>company-core</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
But not when I change the settings to private. I was hoping someone could eplicitly tell me that this isn't possible before I try another approach. It seems strange that the dependency has no issues publishing to github yet I can't find a configuration that will allow the dependent package to pull it down.

Maven in-project repository doesn't work

This is my pom.xml file:
<project ...>
<repositories>
<repository>
<id>lib</id>
<name>lib</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/src/lib</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency>
...
<dependencies>
...
</project>
But there is an error shown on the <dependency> tag: Missing artifact oracle.jdbc:ojdbc6:jar:11.2.0.4
The directory structure is this way:
test-project/
src/
lib/
oracle/
jdbc/
ojdbc6/
11.2.0.4/
ojdbc6-11.2.0.4.jar
Anything missing in the pom.xml file or wrong directory structure?
After searching for hours, eventually found the answer works for me.
Your settings.xml file declares a catch-all mirror. This takes effect over the local repository declaration in your pom file. Either remove the catch-all mirror, or try excluding the repository ID of your project repository from the mirroring:
Replace <mirror>*</mirror> with <mirror>*,!lib</mirror> in your MAVEN/conf/settings.xml
The best solution is start using a repository manager (Artifactory, Nexus, Archiva) and install the oracle jdbc driver there and than you can simply use it as a dependency.
If you really don't like to use a repository manager i can recommend the non-maven-jar-maven-plugin.
This is the solution on Windows but it's quite funny:
Replace
file://${project.basedir}/src/lib
by
file://${project.basedir}\src\lib
Reference:
See the comment in: http://blog.dub.podval.org/2010/01/maven-in-project-repository.html

How to add dojo-maven dependency?

I am currently trying to add dojo as maven dependency in a web project.
I found this link: http://mvnrepository.com/artifact/org.dojotoolkit/dojo-maven/1.8.0
where I copied the dependency node into my POM.
Next I searched where the dojo-maven artefact lies (in which repository). But I cannot find this information. I tried adding:
<repository>
<id>maven2repo</id>
<url>http://central.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
But when I build it sais: Could not find artifact org.dojotoolkit:dojo-maven:jar:1.8.0 in maven2repo (http://central.maven.org/maven2/)
The dojo-maven artefact can be found here http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22dojo-maven%22
Another place to search can be here http://download.dojotoolkit.org/ under the maven category.
Can someone give me a hint?
Do you have a dependency defined in your pom?
<dependency>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo</artifactId>
<version>1.8.0</version>
</dependency>
This will only add the "compiled" dojo code. It is not the full SDK (with the build utilities, etc). There is an outstanding ticket to publish the full SDK to the maven repository.
http://bugs.dojotoolkit.org/ticket/15120

Why is maven looking for artifact in the wrong repo?

I'm defining a dependency in pom.xml in a Maven 3 project. Dependency is as follows:
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<scope>runtime</scope>
<version>2.2</version>
</dependency>
Repostory is described in pom as follows:
<repository>
<id>java.net</id>
<name>java.net</name>
<url>http://download.java.net/maven/2</url>
</repository>
Artifact is indeed present in the repository. It's easy to check. Despite that, Maven is trying to obtain the artifact from repo1.maven.org. What could be the reason of this? Maybe I make some crucial mistake in defining repository access? Other dependencies seem to do fine.
Plugin org.mortbay.jetty:maven-jetty-plugin:6.1.26 or one of its
dependencies could not be resolved: Could not find artifact
org.glassfish.web:el-impl:jar:2.2
in central (http://repo1.maven.org/maven2)
The repository that you have defined is used for dependencies, but not for plugins. Hence the error.
To address this, you need to define pluginRepositories:
<project>
<!-- ... -->
<pluginRepositories>
<pluginRepository>
<id>{repo.id}</id>
<url>{repo.url}</url>
</pluginRepository>
</pluginRepositories>
</project>
As to where you should specify - in pom.xml or settings.xml, read this SO post.
You need to check your maven settings.xml (Look into Maven folder: M2_HOME/conf).
The default repositories are defined there itself, and Maven central repository is taking precedence.
Define your repository in Maven's settings.xml like this:
<profiles>
<profile>
...
<repositories>
<repository>
<id>Java Net</id>
<name>Java Net</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
...
</pluginRepositories>
...
</profile>
You can maybe overwrite the default Maven central repository location with yours if you don't want to do much configuration.
Cheers!
In my case, the real root issue was that the repo required authentication. However for some reason maven decided that it would be much better to not tell me that, and to instead use the first repo in the <repositories> list, and throw the Could not find artifact error for that repo.
After moving the repo that contained the package so it was the first one in the <repositories> list, it started showing me a "permission denied" message. Once maven was setup for authentication with the repo in question, the issue went away.
I had a similar problem however, another developer had set up a mirror in that I simply copy-pasted into my settings.xml file. Modifying the mirrorOf property to only include specific repos did the trick.
In addition to the above mentioned answers, make sure your settings.xml is saved as an xml file not a text file i.e. its not saved settings.xml.txt.

Resources