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 <BUILDSPEC>, 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