MyEclipse+Maven Development Web Project Configuration

1. Activate and configure the Maven plugin for MyEclipse---I am using MyEclipse8.5, which itself has a plugin called Maven4MyEclipse, just need to activate and configure it.

Activation method: window-->preference-->MyEclipse-->Maven4MyEclipse, check the checkbox (Enable Mave4MyEclipse features).

Configuration method: Just under the node opened by the activation method, there is a Maven node, expand this node, mainly configure the two nodes under it, as follows:

Installations: This node uses the built-in maven by default, we need to use the maven we installed , click "add", add a maven that we installed externally, pay attention to check it after adding.

User Settings: The default is the .m2/settings.xml file in the user directory of the C drive. Here, the configuration file used by the externally installed maven needs to be configured. For example, I use the conf/settings.xml file in the maven installation directory. Select Don't forget to click the "Update Settings" button below

2. Use the Maven project in MyEclipse to import, the steps are as follows:

  1> Use the import function in MyEclipse, select File-->Import...-->Existing Maven Projects (different here), select the project directory and import it. ---Import here, MyEclipse may update the index online, it is very slow, we can cancel (click the big red box in the Progress panel), then the project is imported, but it does not perform the necessary operations, such as maven's dependcy Check, etc., then proceed to step 2.

  2> Update the project configuration, right-click the project-->Maven4MyEclipse-->Update Project Configuration

3. Add the Web Project function of MyEclipse

So far , we have only imported a Maven webapp into MyEclipse, but in MyEclipse, this It's just a common Maven project in Java. In this step, we will add the web project feature of MyEclipse to it.

Select Project-->MyEclipse-->Project Capabilities-->Add Web Project Capabilites, set the parameters in the pop-up window as follows, and then select yes in the next pop-up window. In this way, our project is a web project (note that the project icon has changed, and MyEclipse automatically depends on the JEE package).


4. Configure the project properties and open the project properties panel---this step is very important, it is all detailed configuration, and it is indispensable

1) Java Build Path

1> Source

add src/main/java, src/test/java, src /test/resources is the source folder, there is no need to elaborate here, just click "add folder".

The "default output folder" of the minimal facet is changed to "mywebapp/src/main/webapp/WEB-INF/classes"---this is very important

Modify the output directory of these source folders, in which main/java and main/resources are output to the default output folder, and test/java and test/resources are output to target/test-classes, (how to modify---click under each node Output Folder, and then click the edit button on the right.) The final setting result is as follows:

2> Order And Export

In order to display a good-looking, adjust the display order, not to go into details, it is very simple, see the following figure:

2) Java Compiler

notices the above In the picture, my project shows that the jdk is 1.4, so we need to modify it to the version we want. It will not be described in detail here, and it should be changed.

3) Myeclipse-->Web
is used to modify the web features of the setting project, as shown in the figure below:

Well, a MyEclipse Web Project + Maven webapp project is built. The rest is to develop and debug the web in myeclipse and finally package it with maven. Of course, the dependency feature of maven must be used (add the jar package to be depended on directly in pom.xml, and then refresh the project and it will be imported automatically).

The attachment is a created helloworld of springmvc, which can be used as a template.
-------OK-------


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326608028&siteId=291194637