• Maven打包遇到的一些问题(zhuan)


    http://qqbwww.iteye.com/blog/2042307

    ****************************************

    #Maven打包遇到的一些问题

    ## 1.将依赖打成一个包
    参考这篇

    ## 2.Fatal error compiling: 无效的目 标版本: 1.7 -> [Help 1]

    因为是在cmd中执行,然后maven依赖jdk,我的环境变量中将JAVA_HOME写死,指导了jdk1.6版本。而这个项目需要1.7版本,在POM文件的编译插件中

    Xml代码  收藏代码
    1. <plugin>  
    2.        <artifactId>maven-compiler-plugin</artifactId>  
    3.        <version>3.1</version>  
    4.        <configuration>  
    5.          <source>1.7</source>  
    6.          <target>1.7</target>  
    7.        </configuration>  
    8.      </plugin>  

     将版本设置为1.7就会报上面的错误。重新指定环境变量JAVA_HOME指到支持1.7以上的JDK就可以了

    eg

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <!-- Your own application should inherit from spring-boot-starter-parent -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-samples</artifactId>
            <version>2.0.0.BUILD-SNAPSHOT</version>
        </parent>
        <artifactId>spring-boot-sample-web-thymeleaf3</artifactId>
        <name>Spring Boot Web Thymeleaf 3 Sample</name>
        <description>Spring Boot Web Thymeleaf 3 Sample</description>
        <url>http://projects.spring.io/spring-boot/</url>
        <organization>
            <name>Pivotal Software, Inc.</name>
            <url>http://www.spring.io</url>
        </organization>
        <properties>
            <main.basedir>${basedir}/../..</main.basedir>
            <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
            <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>  
                    <artifactId>maven-compiler-plugin</artifactId>  
                        <version>3.1</version>  
                    <configuration>  
                    <source>1.7</source>  
                    <target>1.7</target>  
                    </configuration>  
               </plugin>
            </plugins>
        </build>
    </project>
  • 相关阅读:
    @ConfigurationProperties与@Value区别
    @ConfigurationProperties 注解使用姿势,这一篇就够了
    yml基本语法
    IDEA中自动导包设置及自动导包快捷键
    Mac安装JDK1.8详细教程
    Mac Safari 个人收藏夹如何使用?怎么管理?
    sql server分布式alwaysOn
    SQL Server数据库损坏、检测以及简单的修复办法【转】
    (4.44)sql server中的serverproperty
    sql server导出到excel错误:未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序
  • 原文地址:https://www.cnblogs.com/zhao1949/p/6179879.html
Copyright © 2020-2023  润新知