使用idea常见的错误

错误信息:

INFO ------------------------------------------------------------------------

ERROR Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.

3.2:compile (default-compile) on project opennms-puppet-provisioning-adapter: Co

mpilation failure

解决方法:

seting中加入maven(本地安装的maven home)

 或者突然间编译不成功,可以刷新maven

tomcat 中要加入要发布的包,不需要sapcage生成包,然后这里选择发布这个包

idea配置:

项目

   1,文件夹类型制定

   2,mave lib  导入(有pom文件自然就有了,不新就reimport  ->在maven project 中的项目右键)

     web 

         1,设置webapp发布目录

         2,设置java(source) ,resources文件的发布

artifacts 

   设置选用的运行包

   exploded是指解压后的

      下面的output  web-inf下要有classes(右侧available elment右键输出过来),lib(选中maven等的所有jar)

tomcat ;

发布时候制定的是context path,其之后为访地址

 associated with context path [/hb_telesale].

java resouces文件的设置除了在idea中设置还要在pom文件中设置

java source(这个idea一定要设置)  build中的插件编译

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.7</source>

<target>1.7</target>

<encoding>UTF-8</encoding>

</configuration>

</plugin>

resources  resources

plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-resources-plugin</artifactId>

<configuration>

<encoding>UTF-8</encoding>

</configuration>

</plugin>

有下面的也可以

<resource>

        <directory>src/main/resources</directory>/////表示这个目录下的所有文件及子目录的文件

        <includes>

          <include>**/*.xml</include>

          <include>**/*.properties</include>

        </includes>

      </resource>

在源码中不报找不到文件即可,target找不到没有问题

 下图中的resources可能不太标准,因为pom文件有配resources,所以这里不加也可,但是eclipse要加,idea对maven的应用更彻底,所以自动识别了

猜你喜欢

转载自yuhuiblog6338999322098842.iteye.com/blog/2392234