MAVEN builds MVC project specific steps

Source: Internet
Author: User

First, the goal

In this article, I'm going to show you how to create your first Java EE application using spring frameworks and Maven build.

Second, information

MAVEN is a build tool for a Java project (or an automated build tool). It wants to be with ant or Gradle. Maven can automatically download components that are dependent on your project.

Third, the requirements

1. Spring Tool Suite (STS) (Http://spring.io/tools/sts/all), which is applied to Java EE.

Please select the installation file that corresponds to your operating system. I prefer to download a packaged version that has portability.

2. Network connection

Computer networking is required for the first time you create a spring MVC project because you need to download some project templates from spring Repository. Maven also needs to download some spring dependencies. So make sure your computer is connected to the Internet. If you are in an environment where the agent is online, please refer to this tutorial.

Iv. Introduction of configuration

1. Open your STS and select New->spring Project.

2. Name your project (for example: HELLOSPRINGMVC) and select the Spring MVC project template.

3, STS will download the corresponding template.

4. Name your top-level package (for example: Org.munif.app) and click Finish.

5, observe your project structure, your project will produce inexplicable mistakes, that is right. Because we haven't used MAVEN to add spring dependencies.

6. Right click on your spring MVC project and select Run Sa->maven install. Watch the output console window to see if there is an installation progress. After the installation is complete, you can proceed to the next step.

7. Right-click your spring MVC project and choose Maven--Update project.

8. Select your project and click OK until the update process is complete.

Look, there's no mistake.

9. Run your project, right click on the project folder and select Run as, run on Server.

10. Select your Java EE service "VMware vfabrics TC Server is provided by STS." If you want to use a standalone Apache tomat, make the appropriate configuration.

11, complete. Your project should be able to be displayed in an Eclipse-embedded web browser.

Five, frequently asked questions

1, Question # #

Build Workspace error ... couldn ' t find build plan ...

Cause: Your maven dependencies are not downloaded or are not available.

Workaround:

A, make sure that your computer can be networked.

B. Right-click your spring MVC project and choose Run AS--Maven install. Watch the output text window to see the installation progress. Wait until the installation is complete before you can proceed to the next step.

C. Right-click your spring MVC project and choose Maven--Update project.

2, Problem # #

You is behind a proxy

Cause: Your network environment is proxy Internet.

Solution:

A. Add the proxy configuration to your Setting.xml file. When entering preference, set this file as a Maven settings file. (Somehow, settings.xml is not created by default, so you need to create this file yourself.) )

1

2

3

4

5

6

7

8

9

11

-

+

-

+

+

-

-

< settingsxmlns= "http://maven.apache.org/SETTINGS/1.0.0"

xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "

xsi:schemalocation=" http://maven.apache.org/SETTINGS/1.0.0

 

http:/ /maven.apache.org/xsd/settings-1.0.0.xsd "

 

<proxies>

<proxy>

<id>myproxy</id>

<active>true</active>

<protocol>http</protocol

<port>8080</port>

<username >proxyuser</username>

<password>somepassword</password>

<nonProxyHosts> *.google.com|ibiblio.org</nonproxyhosts>

</proxy>

</proxies>

</settings

B. Right-click your spring MVC project and choose Run as--Maven->maven install. Observe the output Console window to ensure that the installation progress is complete.

C. Right-click your spring MVC project and choose Maven--Update project.

3. Question #

Can not find the tag library descriptor for "Http://java.sun.com/jsp/jstl/core"

Typically, this error occurs in a JSP file. Please refer to: http://stackoverflow.com/questions/15434817/ Can-not-find-the-tag-library-descriptor-for-http-java-sun-com-jsp-jstl-core.

You can then use MAVEN install and update project to refresh your projects.

4, Question # #

When you run Maven install, you will get the following error:

[ERROR] ... very long ERROR ...: invalid LOC header (bad signature).

Cause: This indicates that there is probably some dependency on the binary file corruption.

Solution:

Delete ". M2/repository" and then run Maven install to re-download the dependency repository.

5, Problem # #

[ERROR] ... very long errors ...: unresolvedaddressexception

Reason:

A, if you are using a proxy in the form of a domain name in the settings.xml file (for example: proxy.its.ac.id), it means that your DNS cannot resolve this domain name address.

b, if you connect directly to the network, but you still use the proxy configuration in settings.xml.

Solution:

A, in the first case, use the IP address proxy in the settings.xml file instead of the domain name.

B, if you are directly networked, remove the proxy configuration from the settings.xml file.

Finally, hopefully this tutorial will help you use the STS to do the spring MVC development.

Vi. Reference Documents

[1] http://www.mkyong.com/web-development/how-to-configure-proxy-settings-in-eclipse/

[2] Http://maven.apache.org/settings.html

[3] Http://stackoverflow.com/questions/13044628/spring-error-during-build

English Original: http://abdulmuneverlose.wordpress.com/2013/12/19/ first-spring-mvc-project-using-spring-tool-suite-sts-and-maven-build/

MAVEN builds MVC project specific steps

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.