Elipse or MyEclipse project conversion; myeclipse2014 Example

Source: Internet
Author: User

Sometimes the development needs to convert an existing Java project into a Java Web project, or a Java project into a MAVEN project, and that's the problem. How to convert it! This article tells you the method of one-click conversion, of course, you can also change the project folder under the. classpath file to achieve the conversion.

MyEclipse provides one-click conversion function

Whether it's eclipse or myeclipse, just remember the name of the operation: projectfacets; below, use myeclipse2014 to illustrate:

Right-click Project-"myeclipse-" projectfacets-"conversion operation, shown as follows:

It can be found that several types of conversions can be made, where the Dynmicweb Module facets is converted to the Java Web.

2. Complete the project conversion by modifying the. Classpath.

Here's a list of the. classpath files for different types of projects.

1) Java Engineering's. Classpath

Very simple, a total of three modules, SRC, conf, output, where Conf is the IDE (development tool JDK, I set the following path is my new local JDK, the default is MyEclipse javase-6).

<?xmlversion= "1.0" encoding= "UTF-8"?>

<classpath>

<classpathentry kind= "src" path= "src"/>

<classpathentry kind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER" >

<classpathentrykind= "Output" path= "Bin"/>

</classpath>

2) Java Web Engineering. Classpath

Can be found, there are details of the different, Javaweb project has a Java EE module, output (export path) is not bin, generally webroot under the Web-inf under the classes, but this noun can be changed, such as my next call webcontent and a different place is the Web project under the JDK configuration more than one familiar configuration, <attribute name= "Owner.project.facets" value= "java"/>

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

<classpath>

<classpathentrykind= "src" path= "src"/>

<classpathentrykind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER" >

<attributes>

<attributename= "Owner.project.facets" value= "java"/>

</attributes>

</classpathentry>

<classpathentrykind= "Con" path= "Org.eclipse.jst.j2ee.internal.web.container"/>

<classpathentrykind= "Con" path= "Org.eclipse.jst.j2ee.internal.module.container"/>

<classpathentrykind= "Output" path= "Webcontent/web-inf/classes"/>

</classpath>

3) Maven Engineering's. Classpath

Mave project is relatively simple and clear, the first of several SRC is the MAVEN stipulation project structure, a SRC, a target, each directory is divided into main and test, and the other is a more MVN configuration m2e.

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

<classpath>

<classpathentrykind= "src" output= "target/classes" path= "Src/main/java"/>

<classpathentrykind= "src" output= "target/test-classes" path= "Src/test/java"/>

<classpathentrykind= "src" path= "src/main/resources"/>

<classpathentrykind= "src" path= "src/test/resources"/>

<classpathentrykind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER"/>

<classpathentrykind= "Con" path= "Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>

<classpathentrykind= "Output" path= "Target/classes"/>

</classpath>

4) Java to maven. classpth

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

<classpath>

<classpathentryincluding= "**/*.java" kind= "src" output= "target/classes" path= "Src/main/java" >

<attributes>

<attributename= "optional" value= "true"/>

<attributename= "maven.pomderived" value= "true"/>

</attributes>

</classpathentry>

<classpathentryexcluding= "* *" kind= "src" output= "target/classes" path= "Src/main/resources" >

<attributes>

<attributename= "maven.pomderived" value= "true"/>

</attributes>

</classpathentry>

<classpathentrykind= "src" output= "target/test-classes" path= "Src/test/java" >

<attributes>

<attributename= "optional" value= "true"/>

<attributename= "maven.pomderived" value= "true"/>

</attributes>

</classpathentry>

<classpathentrykind= "Con" path= "Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" >

<attributes>

<attributename= "maven.pomderived" value= "true"/>

</attributes>

</classpathentry>

<classpathentrykind= "Con" path= "Org.eclipse.jdt.launching.JRE_CONTAINER" >

<attributes>

<attributename= "Owner.project.facets" value= "java"/>

</attributes>

</classpathentry>

<classpathentrykind= "Output" path= "Target/classes"/>

</classpath>

Elipse or MyEclipse project conversion; myeclipse2014 Example

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.