Summary processing of errors that occur when the MAVEN project compiles and imports eclipse

Source: Internet
Author: User
Tags unsupported sonatype

Summary of error handling when MAVEN projects compile and import eclipse


maven is really powerful and popular in building projects, and not only is there a growing number of open source projects, but even more and more commercial projects are using MAVEN. But I have to say that Maven has a lot of real holes in it, and recently several projects have been built using MAVEN, and the brothers are all in the tears of maven ....
first, MAVEN related project address

Maven Project home page:

http://maven.apache.org/

Maven Download Address:

http://maven.apache.org/download.cgi

Maven Eclipse Plugin

http://maven.apache.org/plugins/maven-eclipse-plugin/

Maven-android-plugin Project homepage:

https://code.google.com/p/maven-android-plugin/

In

Https://code.google.com/p/maven-android-plugin/wiki/Changelog can view the version history of Maven-android-plugin.

Online Update Address:

M2E Maven archiver Connector

Http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.15.0/N/0.15.0.201207090125/Enabled

M2e-android

Http://rgladwell.github.com/m2e-android/updates/Enabled


Compile Error Summary

1. About compiling the MAVEN version problem

(1) When the Maven3.0.5 version is compiled,

Maven-android-plugin maximum support to 3.5.3, later maven-android-plugin, compilation error.

(2) When the Maven3.1.1 version is compiled,

Maven-android-plugin Best Use 3.8.1

And in the Android Project under Maven project, specify the SDK version. Otherwise, the SDK path error is prompted. Add the following:

    <plugin>
         <groupId>com.jayway.maven.plugins.android.generation2</groupId>
         < artifactid>android-maven-plugin</artifactid>   
         <version>3.8.1</version>
         < extensions>true</extensions>
            <configuration>
           <sdk>
                 <platform>15</ platform>
           </sdk>
       </configuration>
  </plugin>

If you import the eclipse environment, you need to execute mvneclipse:eclipse under CMD, and then use the import of an existing MAVEN project that rebuilds the MAVEN Eclipse project.

When you execute maven install in an Eclipse environment, you may get an error and you cannot find the Tools.jar package.

Then verify that the path to the JREs in Eclipse is correct.

Condition: This exception occurred when using MAVEN to package the project, prompting the tools to not find it.

FIX: Make sure that your eclipse in the preferences--"java--" installed JREs the JRE is pointing to jdk instead of Jre,tools.jar jdk. of course, you can also in the environment variable classpath inside the JDK's lib directory gaga.



third, all kinds of errors in detail 3.1 command line compilation and packaging issues 3.1.1 Maven3.0.5

1. Configure maven-android-plugin3.3.0~3.5.3

Can be compiled by using Mvninstall in cmd command-line mode.

2. Configure maven-android-plugin3.6.0~3.8.1

Configure maven-android-plugin3.6.0, Prompt for error:

[ERROR] Failed to execute Goalcom.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.6.0: Generate-sources (Default-generate-sources) on Project Co
ntroltower-android:execution Default-generate-sources Ofgoal Com.jayway.maven.
plugins.android.generation2:android-maven-plugin:3.6.0:generate-sourcesfailed:
 No AndroidPlatform Version/ API level has been configured. ADD e.g. <sdk><plat
form>17</platform></sdk> to the pluginconfiguration.-> [Help 1]
[ERROR]

Configure maven-android-plugin3.7.0, Prompt for error:

[ERROR] Failed to execute Goalcom.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.7.0: Generate-sources (Default-generate-sources) on Project Co
ntroltower-android:execution Default-generate-sources Ofgoal Com.jayway.maven.
Plugins.android.generation2:android-maven-plugin:3.7.0:generate-sourcesfailed:
 No android APILevel has been Configured.  Add E.g.<sdk><platform>17</platform
></sdk> to the plugin configuration.-> [HELP1]

Configure maven-android-plugin3.8.0, Prompt for error:

[ERROR] Failed to execute Goalcom.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.8.0: Generate-sources (Default-generate-sources) on project Co
ntroltower-android:the Plugincom.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.8.0 requires maven version 3.1.1- >[help 1]
[ERROR]

Error handling:

For the maven-android-plugin3.6.0~3.7.0 version, the lack of a configuration entry to configure the Android SDK is indicated, and the ANDROIDSDK version can be added to the MAVEN profile Pom.xml of the Android project.

As follows:

 <pluginManagement> <plugins> <plugin> <groupid>org.apache.maven.plugins</ Groupid> <artifactId>maven-compiler-plugin</artifactId> <inherited>true</inherit ed> <configuration> <source>1.6</source> <target>1.6</target&
         Gt </configuration> </plugin> <plugin> <groupid>com.jayway.maven.plugins.andro Id.generation2</groupid> <artifactId>android-maven-plugin</artifactId> <version>
                      3.7.0</version> <extensions>true</extensions> <configuration>
                      <sdk> <platform>15</platform>//--> The version number for the Android SDK </sdk> </configuration> </plugin> </plugins> </plugin management&Gt 

MVN install can then be compiled and packaged through.

For maven-android-plugin3.8.0 its error prompt explicitly requires the plug-in to be configured with Maven3.1.1, you must use the Maven3.1.1 version if you want to use more than maven-android-plugin3.8.0 versions of Plug-ins. 3.1.2 Maven3.1.1

After configuring a different version of Maven-android-plugin in the MAVEN configuration file of the Android project, execute in the cmd command-line environment: MVN install, the following errors occur:

Configure maven-android-plugin3.3.0, Prompt for error:

[ERROR] Failed to execute goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sourcesfailed:
A Required Class wasmissing while executingcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0: Generate-sources:lorg/sonatype/aether/repositorysystem;

Configure maven-android-plugin3.5.3, Prompt for error:

[ERROR] Failed to execute goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.3:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.3:generate-sourcesfailed:
A Required Classwas missing while executingcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.5.3: Generate-sources:lorg/sonatype/aether/repositorysystem;

Configure maven-android-plugin3.6.0, Prompt for error:

[ERROR] Failed to execute goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-sourcesfailed:
A Required Classwas missing while executingcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0: Generate-sources:lorg/sonatype/aether/repositorysystem;

Configure maven-android-plugin3.7.0, Prompt for error:

[ERROR] Failed to execute goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.7.0:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.7.0:generate-sourcesfailed:
A Required Classwas missing while executingcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.7.0: Generate-sources:lorg/sonatype/aether/repositorysystem;

Configure maven-android-plugin3.8.0, Prompt for error:

[ERROR] Failed to execute goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate-sources ( default-generate-sources) on project Controltower-android:executiondefault-generate-sources of goal Com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate-sourcesfailed:
 No Android API level has been configured.  Add e.g.<sdk><platform>17</platform></sdk> to the pluginconfiguration. -> [Help 1]

Configure maven-android-plugin3.8.1, Prompt for error:

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.1:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.1:generate-sourcesfailed:
 No Android API level has been configured.  Add e.g.<sdk><platform>17</platform></sdk> to the pluginconfiguration. -> [Help 1]

Error handling:

Error tip for maven3.1.1+maven-androird-plugin3.3.0~3.7.0 configuration:

A required Classwas missing while executingcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.7.0: Generate-sources:lorg/sonatype/aether/repositorysystem;

Only Maven-android-plugin plugin to 3.8.0+ version can be updated

Error tip for maven3.1.1+maven-androird-plugin3.8.0+ configuration:

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate-sources ( default-generate-sources) on Project Controltower-android:executiondefault-generate-sources of goalcom.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate-sourcesfailed:
 No Android API level has been configured.  Add e.g.<sdk><platform>17</platform></sdk> to the pluginconfiguration. -> [Help 1]

The version configuration entry for the Android SDK needs to be added to the Andorid Maven project configuration file as follows:

<pluginManagement>

     <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> < Artifactid>maven-compiler-plugin</artifactid> <inherited>true</inherited> <confi guration> <source>1.6</source> <target>1.6</target> </config uration> </plugin> <plugin> <groupid>com.jayway.maven.plugins.android.generati On2</groupid> <artifactId>android-maven-plugin</artifactId> <version>3.7.0</v
                      Ersion> <extensions>true</extensions> <configuration> <sdk> <platform>15</platform>//--> This is the version number for the Android SDK &L t;/sdk> </configuration> </plugin> </plugins> </pluginmanagement& Gt

In summary, the command line compilation package MAVEN project can be used in a combination of:

maven3.0.5+maven-android-plugin3.3.0~3.5.3

maven3.1.1+maven-android-plugin3.8.0~3.8.1

3.2 error prompts when importing Eclipse

Build Eclipse project through MVN eclipse:eclipse

Prompt for error when importing MAVEN project using Eclipse: Resolve later

maven3.0.5+maven-android-plugin3.3.0 Tip:


maven3.0.5+maven-android-plugin3.5.3 Tip:


maven3.0.5+maven-android-plugin3.7.0 Tip:


Use maven-android-plugin3.7.0 to prompt for an error when importing into the Eclipse Environment after command line compilation passes MVN eclipse:eclipse:

No marketplaceentries found to handle Android-maven-plugin:3.8.0:consume-aar in Eclipse. Please have a information for more.

Network connectivity issues:

[ERROR] Failed to execute goal onproject javadrone-utils:could not resolve DEP endencies Forproject
e-utils:jar:1.3:failed to collect
 dependencies atcom.twilight:h264-decoder:jar:1.0:failed to read artifact desc< C3/>riptor forcom.twilight:h264-decoder:jar:1.0:could not transfer artifact com.tw Ilight:h264-decoder:pom
: 1.0from/to (HTTP://REPO.MAVEN.APACHE.ORG/MAVEN2): Connection to http://repo.maven.apache.orgrefused: Connection timed Out:connect-> [Help 1]


Iv. about error unsupported iclasspathentrykind=4

When you import a MAVEN project into eclipse, an error full prompt appears as follows:


Aninternal error occurred during: "Importing Maven Projects".

Unsupported Iclasspathentry kind=4

This error online has a lot of netizens have provided the processing method, here directly quotes Netizen KONGQZ to this problem treatment way: http://blog.csdn.net/kongqz/article/details/7770765, this processing method is also correct and is the majority of netizens to take the way. As follows:

This exception will cause the project to fail to start with Springide

The English explanation is as follows:

Pleasesee Https://bugs.eclipse.org/bugs/show_bug.cgi?id=374332#c14

Theproblem is caused by the fact this STS (the Spring ide/eclipse) uses them2e (Clipse) plugin but that eclipse:eclipse has been probably been run on TheProject. When M2e encounters a "var". Classpath entry, it throws Thiserror.

Inorder to the fix this problem, your need to do 2 things:

1. Make sure this version of THEM2E (Clipse) plugin that you ' re running are at least 1.1.0. The Update site ishere:https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.1.0/n/latest/

2. Disable the Maven TheProject (via the right-click menu), run MVN Eclipse:clean (while your projectis open Insts/eclipse), and then re-enable the MAVEN nature.

The Chinese explanation is

The problem is that the M2eclipse plug-in is used with Springide, but the use of this plugin is not allowed to command MVN Eclipse:eclipse on the project, and if it does, it throws the exception.

There are two things that need to be done to fix the problem at this stage

1, to ensure that the version of M2E plug-ins than 1.1.0, if not to the site upgrade: https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.1.0/N/LATEST/

2, remove the project Maven features, right-click menu can be removed, and then perform MVN Eclipse:clean, and reactivate the MAVEN feature

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.