zoukankan      html  css  js  c++  java
  • eclipse新建maven web工程

    每次建maven项目,总会有问题。决定在这整理一次,避免以后浪费时间。

    最后目录为

     1.首先修改pom.xml

    之前老是出现明明改了 java compiler 已maven update 一下就又变回来的情况 例如这种错误:

    Dynamic Web Module 3.0 requires Java 1.6 or newer.
    Java compiler level does not match the version of the installed Java project facet.
    One or more constraints have not been satisfied.(被这个错误折磨好久,每次新建maven项目都要弄好久)

    在加上下面代码就好了,因为1:maven 2.1默认用jdk 1.3来编译,maven 3 是用jdk 1.5,如果项目用的jdk 1.7也会有问题,compiler插件可以指定JDK版本为1.7。 

    compiler插件能解决: 
     
    <build>
    		<finalName>Maven</finalName>
    		<pluginManagement>
    			<plugins>
    				<!-- 编译器版本 -->
    				<plugin>
    					<groupId>org.apache.maven.plugins</groupId>
    					<artifactId>maven-compiler-plugin</artifactId>
    					<version>3.0</version>
    					<configuration>
    						<source>1.7</source>
    						<target>1.7</target>
    					</configuration>
    				</plugin>
    			</plugins>
    		</pluginManagement>
    	</build>
    

    2.修改java compiler

    保存之后发现 目录变多了

    删除了faces-config.xml,然后打开web.xml

    然后 项目右键--maven--update project 就发现项目不报错了。

    3.新建了jsp文件 报错了,是因为有包没导入

    在pom.xml中加入下面代码 就好了。

     <dependencies>
          <!-- 导入java ee jar 包 -->
        <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>7.0</version>
            </dependency>
      </dependencies>

    反复试验了好多遍 是ok的,如果有更好的方法请告知啦。

  • 相关阅读:
    由“Jasperrpeorts 4.1.2升级到5.1.2对flex项目的解析”到AS3 带命名空间的XML的操作
    c++里的类型转化
    A股市场暴跌背后的三大元凶?
    jQuery简单过滤选择器
    Handling of asynchronous events---reference
    NMAP
    JVM Run-Time Data Areas--reference
    Getting over the dangers of rm command in Linux---reference
    45 Useful Oracle Queries--ref
    手动修改user-agent
  • 原文地址:https://www.cnblogs.com/wangxiaomei/p/6215551.html
Copyright © 2011-2022 走看看