Reprint IntelliJ Idea use experience (I feel its use is a trend)

Source: Internet
Author: User
Tags jboss

Since the beginning of last year to turn to Java, has been looking for a weapon to take advantage of the hand, eclipse is a lot of Java programmers preferred, but I found that once installed some plug-ins, workspace in the number of items reached 10, often crashes, really affect the mood of programming.

Today, the IntelliJ idea 13, which has received many favorable comments in recent years, feels refreshed and recorded as follows:

First, download the installation

Http://www.jetbrains.com/idea/download/This is the official website, support Mac/windows/linux three major mainstream platform, I tried today is the Mac version

Description: IntelliJ idea is a commercial software, with two versions,

Ultimate Edition is a commercial version, perfect function, can be free trial for 30 days, we recommend that you download the version of learning;

Community Edition is a free community version with reduced functionality for Google Android development

another:IntelliJ idea 13 on Mac does not support jdk1.7, if you have an Oracle jdk1.7 installed on your Mac, first revert to the Apple-brought JDK 1.6 (see here for recovery methods)

Second, preference settings

2.1 Skin/font settings

Now more and more ides like the black style of color, IntelliJ idea also caught up with this trend, the first time after the idea, you will see the following interface:

Click the "right" arrow next to configure and select "Preferences" (Reference)

In the top left corner of the search box, enter "Appear" (IntelliJ idea is smart and will immediately match appearance), for reference:

Theme switch to "Darcula", in order to avoid Chinese garbled, reference, the default font to "Dialoginput", size 12th, click OK end

2.2 Maven Settings

After setting the black style skin, IntelliJ idea will restart, also in preferences, find Maven settings, reference, set MAVEN home directory

Note: If the m2_home environment variable is set on your Mac, IntelliJ idea defaults to the M2_HOME environment variable as the home directory of MAVEN, and if you do not set the M2_HOME environment variable, you need to check the override , select the path of native maven

2.3 Application Server Settings

IntelliJ idea already has a built-in support plug-in for almost all major application servers, the interface after adding JBoss EAP 6.2,Weblogic 12.1.2.0.0

2.4 Keymap (shortcut key) settings

In the keyboard scheme, actually found that there is a choice of Visual Studio options,. NET background of programmers blessed:)

third, create Project

First, create a new project

Note: Project in IntelliJ idea is not really project, it's actually a concept with workspace in Eclipse,solution in Visual Studio

Here we choose an empty project, which is equivalent to creating a blank workspace in eclipse or creating a white space solution in Visual Studio, and then entering Project Name in the following interface:

Click Finish, because now is just an empty shell, there is nothing, so will pop up a dialog box, let us add module, here we do not busy to add modules, first set up the JDK of project, refer to our set the entire project JDK version 1.6

To do this, complete the creation of project

four . Add Module

Module is the "project" in Eclipse/visual studio that really contains the code, and the New module, File, adds a

We choose the Maven module, refer to, direct next, i.e. not using any archetype, just create an empty MAVEN project

Next, enter the MAVEN coordinates 3 feature (groupid,artifactid,version) and Continue next

Then enter the module name, I personally think there needs to be improved, the best module name is the default is the input Artifactid, this can reduce user input, and finally click Finish

See, you can find in the project directory tree on the left, the structure of the folder has been shown, double-click Pom.xml Open, we add a junit dependency, IntelliJ idea Smart hints feature is very strong, even the version number of the dependency, can be IntelliSense

Note: If you are adding a junit dependency, remember to add <scope>test</scope>

Try writing a few classes.

Five, operation and commissioning

For reference, note that there is a small triangle down the top left corner, such as, click on it, select "Edit configurations ..."

Reference, click on the + sign in the top right corner to add a maven configuration

The next interface is similar to eclipse, add the command line that Maven executes, refer to it, and fill in the Name column with "friendly" names.

Of course, you can add multiple configurations, such as HelloApp (compile) for compilation, HelloApp (test) for testing, save the configuration, go back to the idea main interface, find the drop-down box, and there's something.

The triangle button on the right side of the drop-down box means run, and the "glowing Sun" button on the right side of the triangle, indicating debug (debug), click on them to "run" or "Debug"

In addition: for unit testing, in addition to the configuration to perform mvn clean test, you can also have a dedicated junit configuration, and then just click + Add configuration, you can add JUnit configuration, this people try to know, but I do not recommend this, because there is a simpler way, such as, First open the class file with @test, and then stop the cursor in the method to be tested, such as Testadd, press SHIFT+CONTROL+F10 directly, you can let the IDE automatically help us generate JUnit configuration, and immediately run the configuration

Vi. adding web Modules

Still in the following Add module interface, idea defaults to bring some archetype, but the number is limited, such as the archetype provided by JBoss is not

Tick create from archetype, and then click Add Archetype to manually add a jboss example WebApp archetype

After clicking OK, you have to select it.

Enter the coordinates of the MAVEN project 3 features

In the next screen, set the MAVEN path (which is usually automatically recognized, no personality), then next

Next enter the name of the module and click Finish

Click Finish, in the following interface, you will find a big error, stating that idea did not recognize the JDK we set up just now (do not know that is not a bug)

Note: After the actual tests found, if in the previous step of the interface, Module SDK here, even if the system has been selected by default JDK 1.6, manually click the next to the small triangle, and then manual selection, finally click Finish, there will be no this error.

On the Jsf-web-sample model, right-click the Open module Setting, open the module's settings, and manually select the JDK version here in the Module SDK

Click OK, just the error is eliminated, but then idea does not automatically create MAVEN directory structure, so the recommendation or the module to delete, again, pay attention to this time must remember to manually select the module SDK, and then click finish!

Normally, idea will automatically help us create the catalog results, as well as some test files

Next, look at how to deploy to JBoss and then edit configurations ... Over here

Click the + sign to add the configuration, but this time choose JBoss

In the Server tab page, fill in the name, and after successful deployment, the browser address to open

In Deployment tab, reference, click + Sign, add artifact to deploy

Note: When deploying on JBoss, deploy the artifact name, be sure to: End of war, we do not modify, otherwise will be reported invalid extension and other errors

Click OK, back to the idea main screen, you will find the Application server panel, there is already a configuration

On the left there is a row of small vertical icon buttons, the first one is to launch, click on it, you can enable JBoss and deploy jsf-web-sample this application, if it goes well, it can be opened directly in the browser

Of course, the function of idea is much more than that, so let's get started and experience it.

Other ideas for more advanced usage, please refer to this blog other articles:

IntelliJ Idea Advanced usage: integrated Jira, UML class diagram plug-ins, integrated SSH, integrated FTP, database management

Eclipse/intellij idea Remote Debugging Hadoop 2.6.0

Eclipse/intellij Idea Integrated Jetty

Automatically generate code with Mybatis-generator

Reprint IntelliJ Idea use experience (I feel its use is a trend)

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.