Adding a Github release to my maven pom.xml file - maven

I need to add the following GitHub project as a dependency in my pom.xml:
https://github.com/loomchild/maligna
This project defines two maven modules: maligna and maligna-ui and I need both.
Unfortunately, it seems only the first module (maligna) is being deployed to a maven artifactory.
I tried using jitPack, as follows:
<pluginRepositories>
<pluginRepository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</pluginRepository>
</pluginRepositories>
...
<depencies>
...
<dependency>
<groupId>com.github.loomchild.maligna</groupId>
<artifactId>maligna-ui</artifactId>
<version>3.0.1</version>
</dependency>
...
</depencies>
but I get the following error
[ERROR] Failed to execute goal on project iutools-core: Could not resolve dependencies for project org.iutools:iutools-core:jar:1.0.2: Failure to find com.github.loomchild.maligna:maligna-ui:jar:3.0.1 in https://repository.apache.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced -> [Help 1]
Is there something I misundertand about how to use jitPack?

Related

Maven not downloading dependency from custom repository

I'm trying to share some code between two projects by loading it as a dependency via maven. For some reason, I can't get Maven to pick up the dependency.
Here's how I generated the shared JAR:
mvn install:install-file -Dfile=/Users/usr1/shared-code-1.0.0.jar -DpomFile=/Users/usr1/shared-code/pom.xml -DlocalRepositoryPath=.
This jar is held in a git repo github.com/myOrg/myRepo/repository where repository is the branch. The configuration described in the pom file for the shared code looks like this:
<groupId>com.myOrg</groupId>
<artifactId>shared-code</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
Here's how I defined the dependency and repository in my other code bases:
<dependency>
<groupId>com.myOrg</groupId>
<artifactId>shared-code</artifactId>
<version>1.0.0</version>
</dependency>
...
...
<repository>
<id>shared-code/id>
<name>Shared code for my stuff</name>
<url>http://raw.github.com/myOrg/myRepo/repository</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>\
The exact error I'm getting when I try and do a mvn clean package is:
[ERROR] Failed to execute goal on project otherCodeBase: Could not resolve dependencies for project otherCode:myProject:jar:latest: Failure to find com.myOrg:shared-code:jar:1.0.0 in http://[company's artifactory repo] was cached in the local repository, resolution will not be reattempted until the update interval of artifactory has elapsed or updates are forced -> [Help 1]
At first glance, it looks like Maven isn't even scanning the repository I defined in my other code's pom file, but when I execute mvn help:effective-pom it does appear. I should also add that I did make this repository public for the sake of getting it to work once. What gives?

How to add maven dependency from github?

I'm trying to figure out how to configure my pom file to add a dependency that is published on Github but which does not appear in the central repository. The jpen library is published here:
https://github.com/qupath/qupath/tree/master/maven/repo/net/sourceforge/jpen/jpen/2-150301
Below is what I've added to my POM file:
<project>
...
<repositories>
<repository>
<id>msel.releases</id>
<url>https://github.com/qupath/qupath/tree/master/maven/repo/net/sourceforge/jpen/jpen/2-150301</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
...
<dependency>
<groupId>net.sourceforge.jpen</groupId>
<artifactId>jpen</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
</project>
When I compile I get:
Failed to execute goal on project MacawSwing:
Could not resolve dependencies for project com.kitfox.macaw:MacawSwing:jar:1.0-SNAPSHOT:
Failed to collect dependencies for [com.kitfox.macaw:MacawCore:jar:1.0-SNAPSHOT (compile),
com.kitfox.docking:MacawDocking:jar:1.0-SNAPSHOT (compile),
net.sourceforge.jpen:jpen:jar:4.0.0 (compile),
javax.vecmath:vecmath:jar:1.5.2 (compile)]:
Failed to read artifact descriptor for com.kitfox.docking:MacawDocking:jar:1.0-SNAPSHOT:
Failure to find com.kitfox.macaw:Macaw:pom:1.0-SNAPSHOT in https://github.com/qupath/qupath/tree/master/maven/repo/net/sourceforge/jpen/jpen/2-150301
was cached in the local repository, resolution will not be reattempted until the update interval of msel.releases has elapsed or updates are forced -> [Help 1]
Those other dependencies are either local on my machine or in central and compiled fine before I tried to add the jpen dependency.
How can I fix this?
Some options:
If you are using a Nexus server you can add that dependency to that.
Add it to Maven Central (please contact the development team of the Git project).
Make use of JitPack. Clone the
project on GitHub and change the configuration to let it work with
JitPack. Also configure JitPack in your own Maven Pom.
It is also advisable to make use of released or tagged versions instead of a snapshot version.

Spring Asciidoctor Extensions not in correct repo?

Good afternoon guys,
I've been trying to get spring-asciidoctor-extensions to work with my documentation but for some reason maven can't find the dependency.
The error i got after my build attempt:
Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.5:process-asciidoc (generate-docs) on project organization: Execution generate-docs of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.5:process-asciidoc failed: Plugin org.asciidoctor:asciidoctor-maven-plugin:1.5.5 or one of its dependencies could not be resolved: Failure to find io.spring.asciidoctor:spring-asciidoctor-extensions:jar:0.1.1.RELEASE 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 -> [Help 1]
I checked thier GitHub and looked around to find out that theres nothing in the maven repo (obvious from error) and in this question found that the repo is in https://repo.spring.io/release. Is there a way to reference a dependency to a repo directly? If not what can i do?
You can add the repo.spring.io repository to your pom.xml.
<repositories>
<repository>
<id>spring-repo</id>
<url>https://repo.spring.io/release</url>
</repository>
</repositories>
With that declaration in place you will be able to resolve this dependency:
<dependency>
<groupId>io.spring.asciidoctor</groupId>
<artifactId>spring-asciidoctor-extensions</artifactId>
<version>0.1.1.RELEASE</version>
</dependency>
More details in the docs.
Note: it is not possible to explicitly associate this dependency with that repository. Maven walks through the repositories in order of their declaration until a given dependency is resolved (or not) however if all of your other dependencies are resolved from Maven Central then the only dependency left to be resolved from repo.spring.io will be spring-asciidoctor-extensions.
I ran into this issue as well. My misconception at first was that I expected the dependencies to be resolved from the repositories section. However turns out that it's rather the pluginRepositories section. Like so:
<pluginRepositories>
<pluginRepository>
<id>spring-repo</id>
<url>https://repo.spring.io/release</url>
</pluginRepository>
</pluginRepositories>

Official Maven repo for com.springsource.org.jboss.el

I have a project with a dependency org.jboss.el:com.springsource.org.jboss.el:jar:2.0.0.GA for which I am trying to find the official Maven repository.
It is unclear to me where this depedency should come from. Should I download this and create a Nexus repo myself. Is there a official repo for this artifact?
[ERROR] Failed to execute goal on project myproject: Could not resolve dependencies for project myjar:jar:5.0.0-SNAPSHOT: Failure to find org.jboss.el:com.springsource.org.jboss.el:jar:2.0.0.GA in https://mynexusserver/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
The artifact org.jboss.el:com.springsource.org.jboss.el:jar:2.0.0.GA is available from Spring repositories:
You can add them by adding this snippet inside your settings or POM:
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
Note that the error message you are getting suggest to run Maven with the -U option also, to force the updates of dependencies.

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.

Resources