Maven编译、打war包

Eclipse环境,每次alt+F5刷新Maven项目时,总是会把项目的Java依赖刷新成1.5。

解决办法:在pom中加入如下片段

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

 

打war包

            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-surefire-plugin</artifactId>  
                <version>2.4.2</version>  
                <configuration>  
                      <skipTests>true</skipTests>  
                </configuration>  
            </plugin> 

 

build标签全部内容

<build>
        <finalName>projectName</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>  
                <groupId>org.apache.maven.plugins</groupId>  
                <artifactId>maven-surefire-plugin</artifactId>  
                <version>2.4.2</version>  
                <configuration>  
                      <skipTests>true</skipTests>  
                </configuration>  
            </plugin> 
        </plugins>
    </build>

 

posted @ 2018-03-08 15:49  明月出天山  阅读(338)  评论(1编辑  收藏  举报