Tag Archives: maven

Maven Error: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:3.0.0-M1 [How to Solve]

1. Problem description
the Maven project reports an error. When the project is imported and then opened through the development tool, the pom.xml file reports an error.

In addition, an error will be reported when creating a maven project.

2. Error details
failure to transfer org. Apache. Maven. Plugins: Maven surefire plugin: POM: 3.0.0-m1 from http://uk.maven.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of UK has elapsed or updates are forced.
Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to UK ( http://uk.maven.org/maven2 ):
the operation was cancelled.
III. cause of the problem
there is a problem with the file format, Replace the correct file content with the wrong file content.

4. Problem solving
4-1 forced update project
first, check the forced update option through Maven-update project; If the problem is solved, you don’t have to look down.

4-2 delete the local Maven library jar file and download it again
if not, go to Maven local configuration {Maven home}\repo\ORG\Apache\maven\plugins\Maven surefire plugin\

D:\repository\ORG\Apache\maven\plugins\Maven surefire plugin\3.0.0-m1
this is the path of my local library configuration. 3.0.0-m1 is the version I currently use. Back up and delete the files in the 3.0.0-m1 folder.

After deletion, you can download it again through the development tool update project. Here, you can still download it through the development tool. Maven – update check force update of snapshots/releases to

Maven packaging failed invalid LOC header (bad signature)

Maven failed to build the package and reported the following error:

Error creating shaded jar: invalid LOC header (bad signature) -> [ Help 1]

At the beginning, the replacement of the higher version of Maven plugin failed again. However, the error report is more detailed, indicating the problematic jar package: /MNT/D/develop/mavenrepo/COM/Alibaba/fastjson/1.2.44/fastjson-1.2.44. Jar

[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 32.235 s  
[INFO] Finished at: 2019-11-28T20:46:18+08:00  
[INFO] Final Memory: 56M/720M  
[INFO] ------------------------------------------------------------------------  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.1:shade (default) on project flink-base: Error creating shaded jar: Problem shading JAR /mnt/d/Develop/mavenRepo/com/alibaba/fastjson/1.2.44/fastjson-1.2.44.jar entry META-INF/services/org.glassfish.jersey.internal.spi.AutoDiscoverable: java.util.zip.ZipException: invalid LOC header (bad signature) -> [Help 1]
[ERROR]   
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  
[ERROR] Re-run Maven using the -X switch to enable full debug logging.    
[ERROR]   
[ERROR] For more information about the errors and possible solutions, please read the following articles:  
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException  

You can also run MVN – e package and MVN – x package on the command line under the project directory folder according to the prompt, and I see that specific error messages will be printed on the Internet to point out the problematic jar packages. However, it takes too much time to download all jar packages again, so I didn’t try.

Then enter the directory,/MNT/D/develop/mavenrepo/COM/Alibaba/fastjson/1.2.44 /, and find that there is a aether-fb0089ce-dff1-4256-9ccc-a2bb768c48f7-fastjson-1.2.44.jar.sha1-in-progress file in it. Delete all files in the directory and repackage. Success!

Summary: this problem is also the cause of Maven’s error in downloading jar. Most of the problems encountered are the cause of Maven’s error in downloading jar package.

Solve the error in Maven project packaging: error injecting constructor

Error in Maven project packaging: error injecting constructor, java.lang.exceptionininitializererror: cannot access defaults field of properties     at org.apache.maven.plugin.war.WarMojo.< init>( Unknown Source)     while locating org.apache.maven.plugin.war.WarMojo

When locating org.apache.maven.plugin.war.warmojo, you cannot access org.apache.maven.plugin.war.warmojo. & lt; init>( Default field for the property at unknown source)

 

I found many methods on the Internet and finally came to the conclusion that it has nothing to do with the code. Just specify the package plug-in version in pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
            </plugin>

        </plugins>
    </build>

My JDK version is 16. Change to the latest package plug-in version 3.2.2 to package successfully

 

[Solved] Unable to import Maven project: see logs for details when importing Maven dependent package of Spark Program

Issue.
When importing maven dependency packages for a spark application, it fails to import and reports the error.
0:23 Unable to import maven project: See logs for details

2019-08-23 00:34:05,140 [ 747292] WARN - #org.jetbrains.idea.maven - Cannot reconnect.
java.lang.RuntimeException: Cannot reconnect.
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:111)
at org.jetbrains.idea.maven.server.MavenIndexerWrapper.createIndex(MavenIndexerWrapper.java:61)
at org.jetbrains.idea.maven.indices.MavenIndex.createContext(MavenIndex.java:396)
at org.jetbrains.idea.maven.indices.MavenIndex.access$500(MavenIndex.java:48)
at org.jetbrains.idea.maven.indices.MavenIndex$IndexData.<init>(MavenIndex.java:703)
at org.jetbrains.idea.maven.indices.MavenIndex.doOpen(MavenIndex.java:236)
at org.jetbrains.idea.maven.indices.MavenIndex.open(MavenIndex.java:202)
at org.jetbrains.idea.maven.indices.MavenIndex.<init>(MavenIndex.java:104)
at org.jetbrains.idea.maven.indices.MavenIndices.add(MavenIndices.java:92)
at org.jetbrains.idea.maven.indices.MavenIndicesManager.ensureIndicesExist(MavenIndicesManager.java:174)
at org.jetbrains.idea.maven.indices.MavenProjectIndicesManager$3.run(MavenProjectIndicesManager.java:117)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:246)
at com.intellij.util.Alarm$Request.runSafely(Alarm.java:417)
at com.intellij.util.Alarm$Request.access$700(Alarm.java:344)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:384)
at com.intellij.util.Alarm$Request.run(Alarm.java:395)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:242)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.net.SocketException: Connection reset

Reason: maven version problem, I originally used maven 3.6.0, incompatible.
The maven dependencies I need to import are as follows.

<properties>
<scala.version>2.11.8</scala.version>
<hadoop.version>2.7.4</hadoop.version>
<spark.version>2.1.3</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass></mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Test steps.
1. replace the repository with a blank repository. while the path of the repository is shallow, I suspect that the path of the original repository is too deep. Or there is a problem with the original repository content. It didn’t work.
2. pom.xml to remove some dependencies, plug-ins, and then add one by one, no use.

Solution: replace the maven for the idea comes with maven3.3.9.

New Maven project — pom.xml error [How to Solve]

After creating a maven project using the eclipse version integrated with maven, errors will appear in the configuration file pom.xml in the project and the referenced XSD file (errors are reported in the first and second lines)

One example of error reporting:

Multiple annotations found at this line:
– Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)

– CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Could not transfer
artifact org.codehaus.plexus:plexus-compiler-javac:jar:1.8.1 from/to central ( http://repo.maven.apache.org/maven2 ): connection timed out to http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar

– Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins :maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile)

Wait, the error information is similar

 

The reason is that there is a problem with the Maven integrated by eclipse (version problem or website access problem), and the newly installed Maven was not successfully added to the M2e plug-in

The solution is as follows:

step. 1 download the appropriate version of Maven from the official website and store it in the appropriate path (or read which jar package file is missing in the error report – the corresponding error report information will provide the website to download the missing file – copy to the corresponding path of the local warehouse)

step. 2 Open eclipse preferences – > Maven-> Usersettings change global settings and user settings to conf/settings.xml under Maven just downloaded

Step.3   Eclipse preferences – > Maven-> Installations click Add to add the Maven folder you just downloaded, and then check the version you downloaded instead of the built-in version.

step. 4 after the above two steps, you have successfully integrated your downloaded Maven version with eclipse. At this time, right-click the item that reported an error before and right-click run as – > Maven clean and run as – > Maven install.

step. 5 (if not already available): right click – > Maven-> Update Project     This step takes a little time. You can see whether the update is completed by looking at the lower right corner of the interface

Maven:ArtifactdescriptorException: failed to read artifact for xxxxxx

Maven project pom.xml file reported an error “artifactdescriptorexception: failed to read artifact descriptor for…”

       Right click the error reporting item, run as, execute Maven install command, and download the dependent jar package from the remote warehouse to the local warehouse

After downloading, right-click the project – Maven – update project – and select force update of snapshots/releases – OK. Then there will be no error

Maven compilation error “symbol not found” [How to Solve]

The error is reported as follows.

E:\workspace\iccardcore\mis\src\main\java\com\hxsmart\sicard\core\webapp\action\
process\DayEndProcessBean.java:[298,65] Symbol not found
Symbol: Variable autoTapeFile
Location: class com.hxsmart.framework.webapp.util.

E:\workspace\iccardcore\mis\src\main\java\com\hxsmart\sicard\core\webapp\action\
process\DayEndProcessBean.java:[298,118] Symbol not found
Symbol: Variable autoTapeFile
Location: class com.hxsmart.framework.webapp.util.

E:\workspace\iccardcore\mis\src\main\java\com\hxsmart\sicard\core\schedule\DayEn
dJob.java:[94,66] Symbol not found
Symbol: Variable autoTapeFile
Location: class com.hxsmart.framework.webapp.util.

E:\workspace\iccardcore\mis\src\main\java\com\hxsmart\sicard\core\schedule\DayEn
dJob.java:[94,119] Symbol not found
Symbol: Variable autoTapeFile
Location: class com.hxsmart.framework.webapp.util.

Solution.

Make sure the Java code and compilation are OK, clean up using projec->clean and then try again.

 

Eclipse: Troubleshooting of error reports packaged with Maven

1. When packaging with maven in a springboot project, the following error is reported.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project aipp: Fatal error compiling: Invalid marks: -parameters -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The reason is that I have two jdk’s, one 1.7 and one 1.8, my previous project was using 1.7 and now this springboot project is using 1.8, although the project’s Java build path libraries use 1.8 jre, but but

In Windows–>Java–>Installed JREs inside or check the 1.7 jdk, resulting in the above error when packaging, remember to change to check the 1.8

 

Maven does not have a servlet (an error is reported after the servlet is created)

 Maven cannot create a servlet

Solution

Scheme I

Specify the root directory in the IML of the project

 <sourceRoots>
        <root url="file://$MODULE_DIR$/src/main/java" />
  </sourceRoots>

Scheme II

Successfully solved

Error when Maven creates Servlet

Solution

Add in pom.xml (add dependencies under dependencies)

<!-- JSTL -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <!-- Servlet -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
    <!--JSP -->
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>

Successfully resolved

 

What if Maven warehouse has a jar package or reports an error?

This usually occurs when jars cannot be downloaded automatically

1、 Download other files outside the jar package and put them in the corresponding path of the warehouse:

 

Click View all to download other files and put them in the warehouse

 

2、 In this way, the corresponding jar package files of the warehouse will be complete. If the error is still reported, please check whether one is missing_Remote.repositories file

 

No, just copy one under another jar file and modify it accordingly: fastdfs-client-java-1.27-release corresponds to your jar package name

#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Sat Dec 22 16:08:05 CST 2018
fastdfs-client-java-1.27-RELEASE.jar>central=
fastdfs-client-java-1.27-RELEASE.pom>central=

maven21047; <23601;