Modify MAVEN's Java project to Web project

Source: Internet
Author: User

Modifying Maven's Java project to Web project is critical to the following files in the project that need to know about Eclipse and myeclipse. Classpath and. Project and. MyMetadata Meanings and roles.

. project file, the topic of this article is to change Maven's Java project to Web project, and the key is to configure the following:

<?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>

To modify MAVEN's Java project to Web project

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.