Eclipse MAVEN Issues Rollup

Source: Internet
Author: User

In the process of using Eclipse+maven, encountered a series of problems, the first summary records are as follows:

1. In Java engineering, there is a lack of maven dependencies:

This problem is more difficult, generally ECLISPE engineering structure is not very understanding, and later after a long period of investigation, found in the project path there is a. classpath file, normally, this file looks like this:

<?XML version= "1.0" encoding= "UTF-8"?><Classpath>    <ClasspathentryKind= "src"Path= "Src/main/java"/>    <ClasspathentryKind= "src"Path= "Src/test/java"/>    <ClasspathentryKind= "Con"Path= "Org.eclipse.jdt.launching.JRE_CONTAINER"/>    <ClasspathentryKind= "Con"Path= "Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">        <attributes>            <attributename= "Owner.project.facets"value= "Maven.deps"/>        </attributes>    </Classpathentry>    <ClasspathentryKind= "Con"Path= "ORG.ECLIPSE.JDT.JUNIT.JUNIT_CONTAINER/4"/>    <ClasspathentryKind= "Lib"Path= "E:/cvs/fileio/lib/sec.jar"/>    <ClasspathentryKind= "Output"Path= "Target/classes"/></Classpath>

If there is no Maven dependencies in the first diagram, it is because the. CLASSPATH file does not have the configuration Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER, and if this is the case, You can include these lines in the. classpath file in the project path:

<ClasspathentryKind= "Con"Path= "Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">        <attributes>            <attributename= "Owner.project.facets"value= "Maven.deps"/>        </attributes>    </Classpathentry>

Then restart Eclipse to see Maven dependencies as normal. This workaround is for the standard version of Eclispe, such as Eclispe for Java EE Developer.

If a commercial version of Eclipse, such as MyEclipse 2015, has a more convenient solution:

In MyEclipse project facets, you can add Maven Dependencies to your project by selecting Maven Support-dependencies only:

2. The second issue is to install MAVEN externally, and select the Setup source and M2 path settings:

Download Good apache-maven:

Extract:

Set the M2_HOME environment variable in My computer:

Add the Maven bin to path:

%m2_home\bin;

From the command line you can see:

In Eclipse, set up the MAVEN that you just installed:

There are settings.xml in the Conf directory of the MAVEN installation path:

<Settingsxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" >   <Mirrors>    <Mirror>      <ID>CN</ID>      <name>Oschina Central</name>                                                                                                                             <URL>http://maven.oschina.net/content/groups/public/</URL>      <mirrorof>Central</mirrorof>    </Mirror>  </Mirrors>    <localrepository>D:\Java\m2\repository</localrepository></Settings>

Then set in Eclipse, select the settings.xml file you just set up, and you can see that the path in the local repository becomes the local path set in Settings.xml:

3. There was a problem with soruce path and output dir in eclipse, which caused the project to find its own package:

Eclipse MAVEN Issues Rollup

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.