Getting below warning while build.
I am using in pom.xml
<systemPath>${project.basedir}/lib/....jar</systemPath>
[WARNING] 'dependencies.dependency.systemPath' for ...:jar should not
point at files within the project directory,
${project.basedir}/lib/....jar will be unresolvable by dependent
projects # line 25, column 30
Its resolved now by using <systemPath>${pom.basedir}/lib/....jar in pom.xml
Anyone please explain, What is difference between ${pom.basedir} vs ${project.basedir} in pom.xml?
${basedir}, ${project.basedir} and ${pom.basedir} are synonyms (you may also check that using something like mvn help:evaluate -Dexpression=pom.basedir), your Q just reveals that person who was fixing MNG-4953 didn't know about that.
Related
I'm having a strange problem with my project. There are two dependencies in my POM.xml that belong to my company's repository that I would like to delete and replace them with others that are in my local machine . However, when I do, the maven build fails with the following error:
Error:(21,27) java: unmappable character (0xE9) for encoding UTF-8
All I did was delete the two dependencing from POM and from classpath and replace them with the libraries in my local machine.
Could somebody please tell me why the build fails when I delete them from the POM, as if the encoding was depended on them?! And most importantly, if I can't delete them, is there a way I could keep in the POM all while disabling them?
I tried to edit the libraries themselves by addng:
<scope>system</scope>
<systemPath>Path/to/the/local/library</systemPath>
But Maven didn't like it:
'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-jar-plugin # line 865, column 21
Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter. #
I'm trying to do a clean install on this project
https://github.com/jberet/jberet-wildfly-samples
I'm stucked with this error:
Could not resolve dependencies for project
org.jberet.samples:clusterInfinispan:war:1.4.0.Alpha-SNAPSHOT: Failed
to collect dependencies at
org.jberet:jberet-wildfly-cluster-infinispan:jar:1.3.0.Final: Failed
to read artifact descriptor for
org.jberet:jberet-wildfly-cluster-infinispan:jar:1.3.0.Final: Failure
to find org.jberet:jberet-wildfly:pom:1.4.0.Alpha-SNAPSHOT
It appears that artifactory is ONLY available on search.maven.org
I tried to do either a force update -U and to manually clean the local repo directory, but nothing changes.
I wonder if I have to manually add the above repo or should automatically seek there
Any hints?
I think he didn't publish 1.4.0.Alpha in maven center.
You can try to change 1.4.0.Alpha to 1.3.0.Final in pom.xml like this
<parent>
<groupId>org.jberet</groupId>
<artifactId>jberet-parent</artifactId>
<version>1.3.0.Final</version>
</parent>
<groupId>org.jberet.samples</groupId>
<artifactId>wildfly-jberet-samples</artifactId>
<version>1.3.0.Final</version>
And use mvn clean install -Pwildfly
Wow, you are right: https://search.maven.org/artifact/org.jberet/jberet-wildfly-cluster-infinispan/1.3.0.Final/jar
I'm not sure if anybody here on Stackoverflow will be able to help you.
Continue your issue with jberet's community: https://github.com/jberet/jberet-wildfly-samples/issues/2 you have to solve it with them.
EDIT:
Now that I think more about it, it's also possible to add their SNAPSHOT repository to your settings.xml file: https://maven.apache.org/settings.html#Repositories but I didn't find link to their repository.
Anyway: witnessing this I would stay away from jberet project, because this is a big failure on their part.
Read the maven error: "failure to find org.jberet:jberet-wildfly:pom:1.4.0.Alpha-SNAPSHOT" means there is a a dependency referencing org.jberet:jberet-wildfly:pom 1.4.0.Alpha-SNAPSHOT.
Either the repository forbids deploying SNAPSHOT (and it make sense for central)
either your configuration forbids downloading SNAPSHOT (see http://maven.apache.org/settings.html#Repositories).
You should check local pom.xml referencing 1.4.0.Alpha-SNAPSHOT and replace it with a non SNAPSHOT (1.4.0.Alpha for beginners).
The problem: My software uses a library that every developer (and user) has installed in a different location.
The following works in pom.xml:
<project ...>
...
<dependencies>
<dependency>
<groupId>myGroup</groupId>
<artifactId>myName</artifactId>
<version>1.2.3</version>
<scope>system</scope>
<systemPath>C:\...\....jar</systemPath>
</dependency>
</dependencies>
</project>
But when I check this into source control, every developer who needs to change it, has to change the pom.xml, thus having to ignore it at every commit afterwards or to commit partially if he has to change anything else in the pom.xml, such as adding another dependency.
Using a property does not help, it just moves the problem to another location inside the pom.xml.
Using a property and reading it from an external file (properties-maven-plugin) seems not to work since the plugin is called after the dependency checks of e.g. Eclipse: Dynamically adding a Maven dependency from a property
Using environment variables ${env.MY_VARIABLE} seems not to work either: [ERROR] 'dependencies.dependency.systemPath' for myGroup:myName:jar must specify an absolute path but is ${env.MY_VARIABLE} #line 123, column 45
Any ideas on how to solve that?
I would use a repoistory for my jars. Something like nexus or artifactory.
https://www.sonatype.com/nexus-repository-sonatype
https://www.jfrog.com/open-source/
https://binary-repositories-comparison.github.io/
this option works for me:
3. Using environment variables ${env.MY_VARIABLE} seems not to work either: [ERROR] 'dependencies.dependency.systemPath' for myGroup:myName:jar must specify an absolute path but is ${env.MY_VARIABLE} #line 123, column 45
you have to put the jar name included in the path, for example, ${env.MY_VARIABLE/my_jar.jar}.
Also make sure that MY_VARIABLE exists in your environment.
at the end execute the mvn clean and mvn compile commands
I'm receiving the following error on log file.
(java.lang.SecurityException: class
"com.adventnet.snmp.snmp2.SecurityModelTable"'s signer information
does not match signer information of other classes in the same
package thrown
The thing is when I run the below command, it says the jar is verified.
/usr/jdk/instances/jdk1.5.0/bin/jarsigner -verify -verbose Jarfile.jar
If the jar file is verified then how can this problem occur?
It means that you have two or more classes in the same package with different signature data. Usually that means the classes come from different JARs, one of which is signed and the other is unsigned.
Check the pom dependency tree for same packages of different versions.
I had this issue with itext-2.1.7 including old bouncycastle's bcpkix that was included in a later version elsewhere.
Use this pattern:
<dependency>
package X
<exclusions>
<exclusion>
old package Y
</exclusion>
</exclusions>
</dependency>
<dependency>
latest package Y
</dependency>
Update: To check the dependency tree details of package_Y you can use mvn dependency:tree -Dverbose -Dincludes=package_Y. For more info check maven documentation on resolving dependency tree problems. Also Eclipse has quite a nice dependency tree viewer.
I encountered this exception while running a Scala/Spark project in Eclipse (Mars) on Windows and it prevented me from debugging and running the project in the IDE. The project used a Maven pom.xml file. It took a while to resolve, so I'm posting detailed steps here to help others:
Go to the folder where your project pom.xml file is
Run the command: mvn dependency:tree -Dverbose >Depends.Txt
Make sure you don't have a Depends.Txt or it will be overwritten!
Search in the Depends.Txt file for the unsigned class that the Eclipse IDE is complaining about. In my case, it was javax.servlet.
You may find it in a section that looks like this:
+- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.6.0:provided
+- javax.servlet:servlet-api:jar:2.5:provided
The Maven group ID that you want to exclude the duplicate class from in the above is: hadoop-mapreduce-client-core
Add an exclusions section listing the groupid of the exclusion in the pom.xml after the offending package. In my case, this was the groupid javax.servlet.
Note that you can't resolve this issue by reordering the Java build path as some have posted for a similar problem.
I encountered this issue in a Spring boot application. My issue was that I had JUnit on the build path which has Org.hamcrest.Matchers.* and Hamcrest which was resident in the library of the Spring framework in my pom.xml for the Eclipse repository. What I did was remove JUnit from my build path and included it only in my pom.xml. My application depended on Maven for JUnit and the *Matchers, so somehow you have two jars for one need, maybe as a library and as a configuration file.
In my program, I have loaded two versions of the same package. One is boprov-jdk15-140.jar, the other is bcprov-jdk15-151.jar. The two are conflicted.
In the JAR package's MANIFEST.MF file, it has the following digest:
Name: org/bouncycastle/crypto/digests/SM3Digest.class
SHA1-Digest: xxxxxxxx
The two JAR files have different SHA1-Digest info.
In my case I had:
Caused by: java.lang.SecurityException: class "org.bouncycastle.util.Strings"'s signer information does not match signer information of other classes in the same package
It was a project with a lot of dependencies and the mvn dependency:tree information did not really helped me.
Here is how I solved my issue:
I did a search "Find in files" using notepad++ on all the M2_REPO
I found a project which redefined "Strings" class in a package exactly identical to "org.bouncycastle.util.Strings" which should originate from the "org.bouncycastle:bcprov-jdk15on" dependency.
Once found, I moved all of these problematic classes in a new package and updated this project version.
Finally I updated the pom of the project which caused me trouble in the first place to use my dependency that uses the new package name.
Problem solved.
I had the following error:
java.lang.SecurityException: class “org.bouncycastle.asn1.ASN1ObjectIdentifier”‘s signer information does not match signer information of other classes in the same package
I was facing this exception when I was trying to make a PDF password protected.
I added the below jars to resolve the problem.
◾itextpdf-5.2.1.jar
◾bcmail-jdk16-1.46.jar
◾bcprov-jdk16-1.46.jar
◾bctsp-jdk16-1.46.jar
I'm using maven to build a ".ear" project that resolves dependencies from a maven repository, and then packages them into an ear (that's probably a redundant sentence...).
When the dependencies show up in the ear file, they're named according to this format:
<artifactId>-<version>.<type>
I'd like them to be named:
<artifactId>.<type>
Can someone point me in the right direction?
If you're using the maven-assembly-plugin to build your ear, you can use the outputFileNameMapping property in your descriptor: http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html#class_dependencySet
However, you're probably better off using the maven-ear-plugin, in which case you can customize the bundleFileName, as described here.
Set the finalName property. See http://maven.apache.org/plugins/maven-assembly-plugin/assembly-mojo.html for more details