2、maven在 Eclipese 上运行

    xiaoxiao2021-03-25  66

    目录

    目录1jar 包的作用范围2maven 项目测试 2-1调整 jdk 版本整个项目编码

    1、jar 包的作用范围

    对应代码:

    为什么要弄作用域呢?因为比如:provided,只在不运行的时候起作用,避免了 servlet-api 和 tomcat 中的冲突。

    2、maven 项目测试

    2-1、调整 jdk 版本&整个项目编码

    如何调?,以下代码放到 pom.xml <!-- 调整jdk版本及编码 --> <build> <plugins> <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> </plugins> </build>

    右键项目 —-> run as —-> maven build —-> tomcat:run

    让本来jdk1.5 —-> 1.7,还需要 update maven

    然后运行成功了。

    测试访问成功
    转载请注明原文地址: https://ju.6miu.com/read-37332.html

    最新回复(0)