I have 4 projects in my eclipse workspace. They are all 4 maven projects. The names are API, Games, Faction, Board.
API is used in all the other maven projects (Games, Faction, Board) and itself depends of a jar into my PC and also HikariCP.
I declare this dependencies in my API pom.xml
<dependency>
<groupId>org.github.paperspigot</groupId>
<artifactId>paperspigot-api</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}\lib\paperspigot-1.7.10-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.8</version>
<scope>compile</scope>
</dependency>
Then I declare on my 3 other projects that they depend of API
<dependency>
<groupId>net.onima</groupId>
<artifactId>onimaapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
But I have a big warning on the API and the error log says this:
I don't understand why is there this error as I can code with the API in my classes. Can someone explain me? Thanks
EDIT: As requested the text of the screenshot:
Description Resource Path Location Type
Project 'OnimaAPI' is missing required Java project: 'paperspigot' OnimaAPI Build path Build Path Problem
Description Resource Path Location Type
Project 'OnimaGames' is missing required Java project: 'onimaapi' OnimaGames Build path Build Path Problem
I don't know why I can't set the pom.xml here so here's a link: https://ghostbin.com/paste/r4u62
You're declaring paperspigot with system scope.
<dependency>
<groupId>org.github.paperspigot</groupId>
<artifactId>paperspigot-api</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}\lib\paperspigot-1.7.10-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
Dependencies with the scope system are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM.
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies
You should declare it with compile scope:
This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
Related
I want to include XStream in my RCP project and used a Maven Dependency to add it to my target definition.
<location includeDependencyDepth="infinite" includeDependencyScopes="compile,provided,runtime,test,system,import" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
From this diagram, it seems like xmlpull is present but XStream throws ClassNotFoundException in the constructor.
java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserException cannot be found by xstream_1.4.20
Looking more closely, I see that there are a number of new plugins named wrapped.bundlename. I then reconfigured the Maven Dependency to produce a feature and added the feature to my core feature.
The run configuration picked up the new feature but xmlpull was still not found at runtime. In desperation, I added all plugins (xmlpull included) to the run configuration but there was no improvement.
Is this the right approach for creating plugins from maven dependencies?
I'm migrating an app to use ehcache 3.10.0 but getting a build error: Could not find artifact javax.xml.bind:jaxb-api:pom:2.3.0-b161121.1438 in central (https://repo1.maven.org/maven2)
I see the file in my local .m2 directory:
.m2\repository\javax\xml\bind\jaxb-api -- 2.3.0-b161121.1438
So that's an IDE issue for why it's not seen in my local build, since it does exist on my local .m2, but this version (2.3.0-b161121.1438) is still not available on maven, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/
So the build fails with that artifact error. Any tips on how to resolve it?
A similar issue has been reported on the ehcache3 github: https://github.com/ehcache/ehcache3/issues/2881
This dependency is causing the issue, from the ehcache pom.xml:
https://search.maven.org/artifact/org.ehcache/ehcache/3.10.0/jar
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>[2.2,3)</version>
<scope>runtime</scope>
</dependency>
Due to the open ended version the following dependency chain is causing this issue: Failed to collect dependencies at org.ehcache:ehcache:jar:3.10.0 -> org.glassfish.jaxb:jaxb-runtime:jar:2.3.0-b170127.1453 -> org.glassfish.jaxb:jaxb-core:jar:2.3.0-b170127.1453 -> javax.xml.bind:jaxb-api:jar:2.3.0-b161121.1438 ...
The only repository i could find that has this specific build is https://maven.java.net/#nexus-search;gav~javax.xml.bind~jaxb-api~2.3.0-b161121.1438~~
But if you look in the following file you can see the error on retrieving the artifact from this repository: .m2\repository\javax\xml\bind\jaxb-api\2.3.0-b161121.1438\jaxb-api-2.3.0-b161121.1438.pom.lastUpdated
Which is for me (with maven 3.8.4): https\://maven.java.net/content/repositories/releases/.error= http\://0.0.0.0/.error=Could not transfer artifact javax.xml.bind\:jaxb-api\:pom\:2.3.0-b161121.1438 from/to maven-default-http-blocker (http\://0.0.0.0/)\: Blocked mirror for repositories\: [...]
This is because maven 3.8.x has started blocking HTTP repositories by default. You could unblock the HTTP repository as follows: How to disable maven blocking external HTTP repositories?
But i would advice you not to unblock unsafe (non HTTPS) repositories. This would need to be changed in the maven settings.xml, complicating the build process.
My preferred solution would be to add an exclusion to the pom.xml file to ignore this specific jaxb-runtime version.
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.10.0</version>
<exclusions>
<exclusion>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</exclusion>
</exclusions>
</dependency>
If you then still need the jaxb-runtime for your project to compile or run, you could include any other compatible version by adding a new dependency to it in your own pom.xml. In this case you can also use dependency management instead of exclusions.
You can pick one here: https://search.maven.org/artifact/org.glassfish.jaxb/jaxb-runtime
Make sure it satisfies the ehcache requirements: <version>[2.2,3)</version>
I need to use AuthenticationRequest in my Maven Java Project. I did a search on the internet and found AuthenticationRequest on this page (OpenID Connect authentication), indicating this library contains AuthenticationRequest. I follow the links on that website to this page (com.nimbusds:oauth2-oidc-sdk-6.13 API Doc) and find a list of packages. I found this library at Maven Repository.
I added the information in my pom.xml in my Maven Project in Eclipse. Updated Project. Yet I am not able to import any packages starting with "com.nimbusds.oauth2".
Here is the dependency info for that library that I put in my pom.xml file:
<!-- https://mvnrepository.com/artifact/com.nimbusds/oauth2-oidc-sdk -->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>6.13</version>
<scope>runtime</scope>
</dependency>
I am following an example code that uses the AuthenticationRequest class. I am having trouble finding the Maven info to put in my pom.xml file that allows me to use that class in my project. How do I find the right info for it?
Since you are developing a class that depends on that AuthenticationRequest class to compile, your maven goal is going to be before runtime. Maven scope of runtime is not appropriate.
You need to modify your pom.xml to specify compile scope:
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>oauth2-oidc-sdk</artifactId>
<version>6.13</version>
<scope>compile</scope>
</dependency>
Since Maven's default scope is compile, you could also just omit the scope tag.
Maven will import dependencies from the Maven Central repository by default. If Maven Central doesn't contain your dependency (I haven't checked) you must specify a repository that does contain it with something of this form in your pom.xml (note the repo is just an example - substitute a real one that contains your dependency)
<repositories>
<repository>
<id>some-example-repo</id>
<url>http://some.example.repo/some_example_path/</url>
</repository>
</repositories>
I have 4 modules in my project.
Module1 (i.e. com.assign.print:printlog.value:3.0.0-SNAPSHOT) has one class i.e. Foo.java, inside this class, on more class is there which is using com.print.assess: mns.pro:2.0
Module2 , Module2 and Module4 are using com.print.assess: mns.pro:6.2.
In my project main pom.xml, the dependency is added as :
<dependency>
<groupId>com.print.assess</groupId>
<artifactId>mns.pro</artifaxtId>
<version>6.2</version>
</dependency>
In Foo.java, I have one class as DataVal.java which is using older version.
If I don't add
<dependency>
<groupId>com.print.assess</groupId>
<artifactId>mns.pro</artifaxtId>
<version>2.0</version>
</dependency>
to Module1 pom.xml, Redline error is coming for DataVal.java saying "cannot resolve the symbol". So when I added the dependency with version 2.0, the error was resolved but while installing project:
Failed while enforcing releasability the error(s) are [
Dependency convergence error for com.print.assess:mns.pro:6.2 paths to
dependency are:
+-com.assign.print:printlog.value:3.0.0-SNAPSHOT
+-com.app.print:print.sal:1.1.3
+-com.print.assess:mns.pro:6.2
and
+-com.assign.print:printlog.value:3.0.0-SNAPSHOT
+-com.print.assess:mns.pro:2.0
and
+-com.assign.print:printlog.value:3.0.0-SNAPSHOT
+-com.print.assess.over:multi-task.rev:3.1
+-com.print.assess:mns.pro:6.2
How to resolve this issue?
Thanks in advance
If you have the dependencyConvergence enforcer rule active (which you obviously have), you need to determine your versions in the <dependencyManagement> (which is different from the standard <dependencies>).
Then you can declare the dependencies without version in <dependencies>. dependencyManagement entries can be in the main pom and in modules as well. #Bahmut gave you the link to understand dependencyManagement.
You may want to move your 6.2 dependency in your main pom to <dependencyManagement> so it does not get imported by default. Then you can simply import the 6.2 version in your module poms like this:
<dependency>
<groupId>com.print.assess</groupId>
<artifactId>mns.pro</artifaxtId>
</dependency>
and in the module where you need version 2, you can import it like this:
<dependency>
<groupId>com.print.assess</groupId>
<artifactId>mns.pro</artifaxtId>
<version>2.0</version>
</dependency>
More information about dependency management can be found here:
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
I generated jars from Talend,and I suppose to use them in a maven project.After some research I know that I have to install this jars in the local maven repository using:
mvn install:install-file -Dfile=non-maven-proj.jar -DgroupId=some.group -DartifactId=non-maven-proj -Dversion=1 -Dpackaging=jar
and then add a dependency:
<dependency>
<groupId>....</groupId>
<artifactId>...</artifactId>
<version>...</version>
</dependency>
But I don't know what to put exactly in the groupId,artifactId and version tag. Help plz
Go to the maven repository https://mvnrepository.com and search for your dependency. Click on the version number and it will show you the complete dependency tag for your talend. e.g
<!-- https://mvnrepository.com/artifact/org.talend.esb.job/org.talend.esb.job.api -->
<dependency>
<groupId>org.talend.esb.job</groupId>
<artifactId>org.talend.esb.job.api</artifactId>
<version>6.3.1</version>
You should specify what is this "Talend"?
Here is simple introduction to maven pom structure:maven pom doc
groupId: This is generally unique amongst an organization or a project.
artifactId: The artifactId is generally the name that the project is known by.
version: is last piece of specification which package to use.
You can find specification to mvn dependencies on maven repository page. Here is an example for Talend ESB jar (newest version):
<!-- https://mvnrepository.com/artifact/org.talend.esb.job/org.talend.esb.job.api -->
<dependency>
<groupId>org.talend.esb.job</groupId>
<artifactId>org.talend.esb.job.api</artifactId>
<version>6.3.1</version>
</dependency>
BTW if you are just using it locally , then you can install jar with any group Id,artifact Id and version you feel like. Just make sure you use the same in your dependencies in project POM.
However this is not the recommended approach, but if you are not sure about the maven coordinates( group Id, artifact Id and version) you can use above given hack.