- idea的设置
- idea创建项目
1.idea的设置
project==》(等价于)eclipse workspace
module==》eclipse project
配置工作区间
1.编码utf-8
找到待修改的项目,点击右键,选择“Open Module Setting”==》在新打开的窗口中,点击左侧的File Encoding==》右侧project Encoding那行改为UTF-8。同时,Default encoding for properties files的编码方式改为UTF-8==》点击“OK”按钮,保存修改。
2.maven
左上角file==》settings==》Build,Execution,Deployment==》Build Tools==》Maven==》右侧Maven home directory,选择本机maven安装目录,maven配置好的话在下拉列表就可以直接看到==》选择User settings file后的Override,选择自己maven的setting.xml和仓库位置==》点击“OK”按钮,保存修改。
创建namen项目
右击项目==》New=》module==》maven==》右边Module SDK选择1。8版本==》勾选reate from archetype; 3.找org.apache.maven.archetypes:maven-archetype-webapp文件 ==》next==》填写name要创建的名字==》next==》框框右上角加号,弹出add...界面==》填写name:archetypeCatalog;Value:internal==》finish
idea基本设置
1.背景色
file->Settings(快捷键Ctrl+Alt+s) ->Appearance & Behavior ->Appearance ->Theme(黑白灰三种)
2.设置鼠标悬浮有注释提示:Settings->Editor->General 勾选 Show quick documentation on mouse move, Delay(ms)可以设置时间:鼠标悬浮多长时间出现文档提示(默认500),时间设为3000
3.设置方法分隔符:File->Settings中打开设置(或Alt+Ctrl+S)->打开Editor->General->Appearance选项页->勾选Show method separators,然后OK
4.忽略大小写提示:File -> Settings->Editor => General => Code Completion, 去掉勾选 Match case
5.自动导包:file->Settings/Preferences -> Editor -> General -> Auto Import勾选Add unambiguous imports on the fly
6.多个类不隐藏,多行显示(默认只显示10个,多余10个时,前面打开的类会被关掉)
Settings -> Editor -> Editor Tabs 取消勾选 Show tabs in single row, Tab limit 设置成想要同 时显示的文件个数,例如 20
7.设置字体大小file->Settings ->Editor->Font-> size
8.设置类文档注释信息:File -> Settings->Editor -> File and Code Templates -> Includes -> File Header->点apply,再点ok即可
9.设置自动编译:选择File->Settings->Build,Execution,Deployment-> Compiler,勾选Build project automatically
10.水平或垂直显示代码:右击项目->Split Vertically
11.idea快捷方式设置成eclipse:点击File菜单,然后选择Settings选项->在左上角输入keymap关键字,下方选择keymap菜单选项->在右侧屏幕界面中,选择Eclipse,如果是mac系统则选项Eclipse mac
12.修改默认浏览器File->Settings->Tools——>Web Browsers——>选择First listed,浏览器选择希望的默认浏览器,Applygs->
2.idea创建项目
//pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>ideamaven</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>ideamaven Maven Webapp</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.44</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>4.0.1</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>ideamaven</finalName> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <!--第一步就是配置maven-compiler-plugin插件--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> </plugins> </pluginManagement> </build> </project>
//web.xml <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> </web-app>
注:后面3张图是新建项目Tomcat8.5.40