1、修改项目中目录属性以及添加目录
Project Struct->Modules->右键->创建文件夹Java 和 resource
然后 让Java文件夹成为source
点击resource文件,右键-》Mark directory as ->resource root即可
2、使用maven自带的tomcat插件
maven tomcat 插件-》
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>80</port>
<path>/shop</path>
<uriEncoding>UTF-8</uriEncoding>
<server>tomcat7</server>
</configuration>
</plugin>
3、常用的快捷键
ctrl+Y 删除
ctrl+alt+l 格式化
Ctrl+Alt+M 重构提取重复代码
4、如何添加模块
Project Structs下面 有project【jdk相关配置】
Project Structs下面 有Modules,可以添加模块,在添加模块的时候,可以设置将其添加到哪个父级项目中 Add as module to ?
然后全部弄好了之后,可以在父级项目中调用子模块,需要添加子模块的maven引用,例如:
<dependency>
<groupId>LZ</groupId>
<artifactId>Commont</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
另外idea会默认帮我们生成:
在父级项目的pom文件中:
<modules>
<module>ddfadfa</module>
<module>Commont</module>
</modules>
在子项目例如Common中的pom文件中:
<parent>
<artifactId>CodeRuler</artifactId>
<groupId>LZ</groupId>
<version>1.0-SNAPSHOT</version>
</parent>