Convert or modify MAVEN Java project to Web project

Source: Internet
Author: User

Converting MAVEN Java project to Web project is critical to the following files in the project to understand Eclipse and myeclipse. Classpath,. Project,

The meaning and role of the related configuration file under the. MyMetadata and setting folders.

. project file, the topic of this article is to convert MAVEN Java project to Web project, the key is the following configuration:

<?xml version= "1.0" encoding= "UTF-8"?>
<?xml version= "1.0" encoding= "UTF-8"?>
<projectDescription>
<!--project Name--
<name>trust_product_admin</name>
<comment></comment>
<projects>
</projects>
<!--compiler to specify &LT;BUILDSPEC&GT;, omit related buildcommand--> here
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<!--additional Eclipse plugins required for runtime---
<natures>
<!--This topic to change MAVEN's Java project to a key component of Web project is webnature-->
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

The. classpath File Detail Description:

<?xml version= "1.0" encoding= "UTF-8"?>
<classpath>
<!--source Directory--
<classpathentry kind= "src" output= "target/classes" path= "Src/main/java"/>
<classpathentry excluding= "* *" kind= "src" output= "target/classes" path= "Src/main/resources"/>
<classpathentry kind= "src" output= "target/test-classes" path= "Src/test/java"/>
<classpathentry excluding= "* *" kind= "src" output= "target/test-classes" path= "Src/test/resources"/>
<!--JDK Runtime container--
<classpathentry kind= "Con" path= "org.eclipse.jdt.launching.jre_container/ Org.eclipse.jdt.internal.debug.ui.launcher.standardvmtype/jdk1.6.0_20 "/>
<!--referring to Maven-related jar--
<classpathentry kind= "Con" path= "Org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind= "Con" path= "Org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" >
<attributes>
<attribute name= "maven.pomderived" value= "true"/>
<attribute name= "org.eclipse.jst.component.dependency" value= "/web-inf/lib"/>
</attributes>
</classpathentry>
<!--compiled output class directory--
<classpathentry kind= "Output" path= "Target/classes"/>
</classpath>

One more. mymetadata file for the MyEclipse project:

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

<!--
Type: Project Types
Name: Project Title
ID: Unique identification of the project within the workspace
Context-root: System root Path
J2EE-SPEC:J2EE Standard
Archive: Post-packaged war file
-
<project-module
Type= "WEB"
Name= "Trust_product_admin"
Id= "myeclipse.1411629788403"
context-root= "/trust_product_admin"
J2ee-spec= "5.0"
Archive= "Trust_product_admin.war" >
<attributes>
<!--value:web root directory name--
<attribute name= "Webrootdir" value= "Src/main/webapp"/>
</attributes>
</project-module>

Some projects may have org.eclipse.wst.common.component files under the Setting folder and modify the configuration:

<?xml version= "1.0" encoding= "UTF-8"?>
<project-modules id= "Modulecoreid" project-version= "1.5.0" >
<wb-module deploy-name= "Product_web" >
<!--<wb-resource deploy-path= "/" source-path= "/target/m2e-wtp/web-resources"/>-->Note: This paragraph needs to be commented out
<wb-resource deploy-path= "/" source-path= "/src/main/webapp" tag= "Defaultrootsource"/>
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/main/java"/>
<wb-resource deploy-path= "/web-inf/classes" source-path= "/src/main/resources"/>
<dependent-module archivename= "Product_core-0.0.1-snapshot.jar" deploy-path= "/WEB-INF/lib" handle= "module:/ Resource/product_core/product_core ">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name= "Java-output-path" value= "/product_web/target/classes"/>
<property name= "Context-root" value= "Trust_product_web"/>
</wb-module>
</project-modules>

Convert or modify MAVEN Java project to Web project

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.