使用maven管理引入jdk1.8

需要在配置文件settings.xml中加入:

    <profile>
            <id>jdk-1.8</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <properties> 
                <maven.compiler.source>1.8</maven.compiler.source> 
                <maven.compiler.target>1.8</maven.compiler.target> 
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
            </properties>
            <repositories>
                <repository>
                    <id>nexus</id>
                    <name>local private nexus</name>
                    <url>http://maven.oschina.net/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus</id>
                    <name>local private nexus</name>
                    <url>http://maven.oschina.net/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>

然后右键点击工程,maven->select maven profiles 选择jdk1.8即可。

posted @ 2016-07-16 19:52  勿妄  阅读(12132)  评论(0编辑  收藏