Tag Archives: Maven error

Maven [error] no longer supports source option 5. Please use version 7 or later

1、 Question

This is the first time I learned Maven from the teacher of station B. because the video is previous, now I learn the knowledge of the past. First of all, we use the latest software or various packages, which leads to a version problem. This problem is really a headache.

The problem I encountered this time is: open the CMD command window to execute“`   MVN compile ` ` ` command, prompt “[error] no longer supports source option 5. Please use version 7 or later.” error message.

  2、 Cause

This is the version mismatch I just talked about. It is mainly the problem of configuration in pom.xml file

The teacher is configured as:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apche.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.njpowernode</groupId>
<artifactId>ch01-maven</artifactId>
<version>1.0-SNAPSHOT</version>
</project>

3、 Solution

Add the following code to the teacher’s configuration:

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
 </properties>

4、 Final result

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apche.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
 </properties>

<groupId>com.njpowernode</groupId>
<artifactId>ch01-maven</artifactId>
<version>1.0-SNAPSHOT</version>
</project>

5、 Successful execution

 

 

[Solved] Maven Error: No compiler is provided in this environment. Perhaps you are running on a JRE rather t…

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

You should specify a JDK instead of a JRE. Show the JRE home, but the need is a complete JDK

Solution: Eclipse — > Window–> preferences–> Java–> Installed jres select the directory and find the location of JDK

If it has been configured, remove it and configure it again

Above has solved the compilation common project to report the wrong question

If you still have problems compiling with maven, you can reconfigure the Maven environment

Eclipse–> Window–> preferences–> Maven–> User Settings

[Solved] Maven error: invalid CEN header (bad signature)

1. Find problems
right click pom.xml, run as – > After Maven install, you will see some similar messages in the console, such as errors in Maven repository, repos, org, mortbay, jetty, servlet-api-2.5, 6.1h.14.1, servlet-api-2.5, 6.1h.14.1, jar and so on. Pom.xml displays a red cross

2. Cause analysis
the package was not downloaded correctly

3. Solution
find the directory of the package, delete the package and download it again. After downloading again, test it with Maven test, and the Red Cross disappears

Maven Error: Failed to execute goal on project xxx: Could not resolve dependencies for project

Error Description:

Failed to execute goal on project xxx: Could not resolve dependencies for project com.jd.ka: xxx:war :0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.jd.ka:ka-explore- service:jar :0.0.1-SNAPSHOT, com.jd.ka:ka-explore- rpc:jar :0.0.1-SNAPSHOT: Failure to find com.jd.ka:ka-explore- service:jar :0.0.1-SNAPSHOT in http://artifactory.jd.com/libs-snapshots-local was cached in the local repository, resolution will not be reattempted until the update interval of snapshots_ local has elapsed or updates are forced -> [ Help 1]

Solution:

1. First of all, I believe that since you have made such a mistake, your project should also have multiple modules. It’s like this:

2. Let me give you an example here, so the application is web and service

3. Both projects inherit the parent project

4. In the module, the web depends on the service. After the clean and install in the web, the local warehouse also has the dependency, but the install in the service will appear

Failed to execute goal on project …: Could not resolve dependencies for project …

In this way, I found that I didn’t clean and install the parent project, that is, the interface test project

5. summary: some subprojects under the parent project should run clean and install of the parent project before running clean and install for the first time

Maven Error: No goals have been specified for this build [How to Solve]

Error:

Nogoalshavebeenspecifiedforthisbuild.Youmustspecifyavalidlifecyclephaseoragoalintheformat<plugin-prefix>:<goal>or<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.Availablelifecyclephasesare:validate,initialize,generate-sources,process-sources,generate-resources,process-resources,compile,process-classes,generate-test-sources,process-test-sources,generate-test-resources,process-test-resources,test-compile,process-test-classes,test,prepare-package,package,pre-integration-test,integration-test,post-integration-test,verify,install,deploy,pre-clean,clean,post-clean,pre-site,site,post-site,site-deploy.->[Help1]

Solution:

pom.xml file<build> tag followed by<defaultGoal>compile</defaultGoal> will do

[Solved] Maven:Unable to import maven project: See logs for details

1. Development environment

idea2019.1 + apache-maven-3.6.2 + JDK 1.8.0_111

2. Problem description

After importing the maven multi-module project, it is found that the project has no multi-module expansion, and the related jar package reference is not seen in External Libraries . Idea also prompts an error: Unable to import maven project: See logs for details

You can  view the specific error log in Help == “Show Log in Explorer :

The error message is as follows:

2019-10-31 13:53:26,315 [9780537] ERROR-#org.jetbrains.idea.maven- com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for org.apache.maven.model.path.PathTranslator was bound.
   while locating org.apache.maven.model.path.PathTranslator
     for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$ 1.configure(DefaultPlexusContainer.java:350 )

2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound.
   while locating org.apache.maven.model.path.UrlNormalizer
     for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$ 1.configure(DefaultPlexusContainer.java:350 )

2 errors
java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for org.apache.maven.model.path.PathTranslator was bound.
   while locating org.apache.maven.model.path.PathTranslator
     for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$ 1.configure(DefaultPlexusContainer.java:350 )

2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound.
   while locating org.apache.maven.model.path.UrlNormalizer
     for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$ 1.configure(DefaultPlexusContainer.java:350 )

2 errors
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java: 543 )
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java: 159 )
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java: 106 )
    at com.google.inject.Guice.createInjector(Guice.java: 87 )
    at com.google.inject.Guice.createInjector(Guice.java: 69 )
    at com.google.inject.Guice.createInjector(Guice.java: 59 )
    at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java: 344 )
    at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java: 332 )
    at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.customizeComponents(Maven3ServerEmbedderImpl.java: 556 )
    at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.customize(Maven3ServerEmbedderImpl.java: 526 )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 62 )
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43 )
    at java.lang.reflect.Method.invoke(Method.java: 498 )
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java: 324 )
    at sun.rmi.transport.Transport$ 1.run(Transport.java:200 )
    at sun.rmi.transport.Transport$ 1.run(Transport.java:197 )
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java: 196 )
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: 568 )
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java: 826 )
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$ 0(TCPTransport.java:683 )
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java: 682 )
    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 )
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java: 283 )
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java: 260 )
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java: 161 )
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java: 227 )
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java: 179 )
    at com.sun.proxy.$Proxy111.customize(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor584.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43 )
    at java.lang.reflect.Method.invoke(Method.java: 498 )
    at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java: 175 )
    at com.intellij.execution.rmi.RemoteUtil.access$ 200(RemoteUtil.java:38 )
    at com.intellij.execution.rmi.RemoteUtil$ 1$1$1.compute(RemoteUtil.java:156 )
    at com.intellij.openapi.util.ClassLoaderUtil.runWithClassLoader(ClassLoaderUtil.java: 66 )
    at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java: 227 )
    at com.intellij.execution.rmi.RemoteUtil$ 1$1.invoke(RemoteUtil.java:153 )
    at com.sun.proxy.$Proxy111.customize(Unknown Source)
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java: 96 )
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.onWrappeeCreated(MavenEmbedderWrapper.java: 49 )
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java: 42 )
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java: 96 )
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda$customizeForResolve$ 1(MavenEmbedderWrapper.java:69 )
    at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java: 76 )
    at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.customizeForResolve(MavenEmbedderWrapper.java: 68 )
    at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java: 1272 )
    at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java: 45 )
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java: 135 )
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$ 000(MavenProjectsProcessor.java:32 )
    at org.jetbrains.idea.maven.project.MavenProjectsProcessor$ 2.run(MavenProjectsProcessor.java:109 )
    at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$ 5(MavenUtil.java:458 )
    at com.intellij.openapi.application.impl.ApplicationImpl$ 1.run(ApplicationImpl.java:311 )
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: 511 )
    at java.util.concurrent.FutureTask.run(FutureTask.java: 266 )
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1149 )
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 624 )
    at java.lang.Thread.run(Thread.java: 748 )
 2019-10-31 13:53:26,316 [9780538] ERROR-#org.jetbrains.idea.maven-IntelliJ IDEA 2019.1 Build #IU-191.6183.87
2019-10-31 13:53:26,316 [9780538] ERROR-#org.jetbrains.idea.maven-JDK: 1.8.0_202-release; VM: OpenJDK 64- Bit Server VM; Vendor: JetBrains sro 
 2019-10-31 13:53:26,316 [9780538] ERROR-#org.jetbrains.idea.maven-OS: Windows 7
2019-10-31 13:53:26,330 [9780552] ERROR-#org.jetbrains.idea.maven- Last Action: CloseProject 
 2019-10-31 13:53:34,447 [9788669] INFO-mponents.impl.stores.StoreUtil -saveProjectsAndApp took 285 ms 
 2019-10-31 13:53:57,391 [9811613] WARN-gin.utils.ProfilingUtilAdapter- YourKit controller initialization failed: To profile application, you should run it with the profiler agent 
 2019-10-31 13: 54:21,528 [9835750] INFO-mponents.impl.stores.StoreUtil-saveProjectsAndApp took 66 ms 
 2019-10-31 13:55:52,584 [9926806] INFO-ide.actions.ShowFilePathAction-  
Exit code 1
2019-10-31 13:55:53,004 [9927226] INFO-mponents.impl.stores.StoreUtil-saveProjectsAndApp took 46 ms

3. Solution

Change to a lower version of maven, such as apache-maven-3.5.4 or apache-maven-3.3.9. This may be caused by the incompatibility between idea2019.1 and the higher version of maven (apache-maven-3.6.2).