IntelliJ Idea:maven & Jetty developing Java Web

Source: Internet
Author: User

Before using Eclipse + maven + jetty to develop Java Web applications, with the idea of no Zuo no gain,

Toss the INTELLJ idea under the development environment of the building, incidentally learning the concept of Maven repository.

Environment

System: OS X Yosemite

Ide:intellij Idea 14.0.1 CE

JDK:1.8.0_25

SVN use

SVN checkout projects to project

Figure 1. Svn

MAVEN uses

The right column of maven Projects;maven Projects a row of buttons is Maven's various functions: such as the third button, you can download the source or document or two are downloaded;

Fourth button can add a MAVEN project (PS:SVN checkout out of the MAVEN project, need to add the MAVEN project in MAVEN projects Pom to use normal use);

Figure 2. MAVEN Projects

Jetty using the Maven plugin

The jetty plugin needs to be defined in the Pom file, as described in the previous blog post http://www.cnblogs.com/hzhesi/p/3968522.html;

After the definition, in Figure 2 plugins can see Jetty, and jetty the corresponding commands, click to execute;

Figure 3. Plugins

Jetty:run Experiencing problem problem description

No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system

View file, other Settings, Default Settings

Build, execution, Deployment-the Maven home directory box in the lower-right corner of build Tools-

Figure 4. Maven home Directory (1)

Solution Solutions

Of course, the installation of Maven, but for the sake of convenience, I first installed the Brew command, official website http://brew.sh/, which has its installation process; After installing brew, use Brew install MAVEN.

When you are done, you can see that Maven home directory in idea is changed from NULL to

Figure 5. Maven Home Directory (2)

At this point, we can finally jetty:run.

Off Topic

The above content belongs to Intellj idea to build the development environment, but I encountered the problem is not over, the following is the digression part , that is, the MAVEN Repository Management Section, related to the project group code, in short, because previously did not consider the OSX system, Therefore, if the system is not Linux and Windows is not the case, it will directly throw a current system is not supported exception.

This part of the code is another MAVEN project on SVN, so, checkout out directly from SVN, adding support for OS X, and then using the Install (6) under lifecycle in Figure 2, before you can run clean, Run the install again, you can install the jar package of the J project to the local MAVEN repository to resolve the issue.

Figure 6. Lifecycle

IntelliJ Idea:maven & Jetty developing Java Web

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.