maven问题集

  • Description Resource Path Location Type
    Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment. oto Build path JRE System Library Problem

新建maven webapp项目后出现,目前的编译环境需要的是javase 1.7,而我电脑上的是1.8,因而需要配置运行环境为1.8

解决办法:找到pom.xml中maven-compiler-plugin配置

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

修改如下:

<plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF8</encoding>
          </configuration>
        </plugin>
  • Classpath entry org.maven.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published

需要将navigator视图下.classpath文件中,添加

<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>

添加元素如下

<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>

然后右击项目 -> propertier -> java build path -> order and export 下选中 Maven,点击确定,最后clean项目即可。

mvn插件库:https://mvnrepository.com/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。