Tag Archives: Maven error

[Solved] Maven Error: parent.relativePath points at wrong local POM

Maven Project Error Messages:

Project build error: Non-resolvable parent POM for com.sap.cloud.sample:connectivity:[unknown-version]: Failure to find com.sap.cloud.sample:sdk-samples-parent:pom:1.0.0 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 and ‘parent.relativePath’ points at wrong local POM

 

Analyze
A parent dependency is defined in the pom.xml of my Maven project named connectivity:

But there is no local pom.xml in the upper-level folder dis of connectivity, so Maven will report the above error message.

 

Solution
Create a new pom.xml in the upper-level folder dis of the current project, and define the content of sdk-samples-parent.

After the problem is solved.

How to Solve Maven Error: Failure to transfer com.thoughtworks.xstream:xstream:jar:1.3.1 from https://repo.maven.ap

Report error in full: Failure to transfer com.thoughtworks.xstream:xstream:jar:1.3.1 from 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. Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:jar:1.3.1 from/to central (https://repo.maven.apache.org/maven2): The operation
was cancelled.
Should be the time to download the package error, go to the repository to delete, re-download it!
After the deletion, maven clean, done!
Similar question.
Failure to transfer org.apache.maven.shared:maven-filtering:jar:1.0-beta-2 from 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. Original error: Could not transfer artifact org.apache.maven.shared:maven-filtering:jar:1.0-beta-2 from/to central (https://
repo.maven.apache.org/maven2): The operation was cancelled.

The same method to solve, are half of the download interrupted, the reason for the package is not complete.

 

[Solved] Maven Error: The packaging for this project did not assign a file to the build artifact

Problem Description
	When using the maven function provided by idea to install a project, the console reports an error
	The packaging for this project did not assign a file to the build artifact
Problem Analysis
	This is to say that the package for the plugin could not be found, in fact, it is not that the package for the plugin could not be found, but that the project did not load the package from the maven repository into the project
Problem solving
	The use of their own is the install under plugins caused by
	should use the Lifecycle install normal operation

How to Solve Maven Error: Return code is: 501 , ReasonPhrase:HTTPS Required.

When using jenkins to build today, the following error was reported

  [ERROR] Failed to execute goal on project saas20: Could not resolve dependencies for project com.ipower365.saas:saas20:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.ipower365.saas:messageserviceimpl:jar:0.0.1-SNAPSHOT -> com.ipower365.boss:nacha:jar:1.0.1: Failed to read artifact descriptor for com.ipower365.boss:nacha:jar:1.0.1: Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central (http://repo1.maven.org/maven2/):Failed to transfer file:http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

We found that this dependent file is available in the local warehouse, but during the build process, after downloading the file in the local nexus, it will still request the file download like the central warehouse.

    [echoing saas20] Downloading from central: http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom

After that, we searched for the problem based on the returned 501 error. The reference link is as follows:

https://stackoverflow.com/questions/59763531/maven-dependencies-are-failing-with-501-error

 

 

As mentioned above, since January 15, 2020, the central repository no longer supports insecure communication via pure HTTP, and requires all requests to the repository to be encrypted via HTTPS.

So we added the following configuration to the settings file that we relied on during the build process:

1
2
3
4
5
6
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>

But the problem is still not resolved, and then an error is reported, the error is as follows:

    Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central (https://repo1.maven.org/maven2/):Received fatal alert: protocol_version -> [Help 1]

This is when using the https protocol to request the central warehouse, the protocol version needs to be specified, and then the following parameters are added when building, the reference link is as follows: 

https://stackoverflow.com/questions/50824789/why-am-i-getting-received-fatal-alert-protocol-version-or-peer-not-authentic

1
-Dhttps.protocols=TLSv1.2

Then when you build again, the request is passed!

Reason: Our Java environment uses 7 and 8, while our mvn version uses 3.5.x.

Therefore, when using mvn packaging in the JAVA8 environment, the above parameters do not need to be specified, but when using the JAVA7 environment, the above error will occur. Later, we will consider updating the version of mvn and unified JAVA environment

Solve Maven project running error Failed to clean project: Failed to delete

As in the question, the error “Failed to clean project: Failed to delete” is reported when running the maven project. The reason is that the previously compiled project is still running and cannot be cleaned, which makes the maven life cycle unable to continue.

The solution is as follows:

Close the current eclipse console, as shown below:

 

 

After closing the console, the last running console will appear, just stop running:

 

 

Re-run the maven project and the problem is solved.

[Maven Error] Exception in thread “main” java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0

1. Abnormal information

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

 

The solution(Two Methods):

1. Check whether your JAVA_HOME environment variable is configured correctly, and verify by echo $JAVA_HOME (this is the situation I encountered)

2. Check whether the jdk version your maven depends on is compatible with your locally installed jdk version

Maven Error: Missing artifact jdk.tools:jdk.tools:jar:1.7

and tools.jar The package comes with JDK, so I doubt it pom.xml Implicit dependency in tools.jar Bag, and tools.jar Not in the library,

For example: the current project relies on package a, while package a relies on package a during the development and packaging process tools.jar Package a is released now. Our project depends on package a, so we should add package a to the package dependency tools.jar Package;

After this analysis, the problem is easy to solve, directly in the pom.xml Add a dependency project to the list:

		<dependency>
			<groupId>jdk.tools</groupId>
			<artifactId>jdk.tools</artifactId>
			<version>1.7</version>
			<scope>system</scope>
			<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
		</dependency>

Error in the project tag in the POM file of Maven project: failure to transfer

Question:
The Maven project was detected from SVN today, and the project label of the POM file after it was imported into ECLISE reported an error. The error content was very long, and the initial content was roughly Failure to Transfer…. + the version of a JAR package +…..
Solution:
Select the error report item, right-click on the item –>; Maven – & gt; Update Project, Force Updateo of Snapshots/Releases:

 
Just wait for the execution to finish, at least that’s how my error was resolved.