【转】新建maven工程为什么jdk会是默认版本 而不是自己设置的版本?

原文链接:为什么我eclipse新建项目的时候默认的是JRE1.5?

修改Maven中conf目录里的setting.xml文件内容,加上如下内容:

<profiles>
        <!-- profile | Specifies a set of introductions to the build process, to
            be activated using one or more of the | mechanisms described above. For inheritance
            purposes, and to activate profiles via <activatedProfiles/> | or the command
            line, profiles have to have an ID that is unique. | | An encouraged best
            practice for profile identification is to use a consistent naming convention
            | for profiles, such as ‘env-dev‘, ‘env-test‘, ‘env-production‘, ‘user-jdcasey‘,
            ‘user-brett‘, etc. | This will make it more intuitive to understand what
            the set of introduced profiles is attempting | to accomplish, particularly
            when you only have a list of profile id‘s for debug. | | This profile example
            uses the JDK version to trigger activation, and provides a JDK-specific repo. -->
        <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>

        <!-- | Here is another profile, activated by the system property ‘target-env‘
            with a value of ‘dev‘, | which provides a specific path to the Tomcat instance.
            To use this, your plugin configuration | might hypothetically look like:
            | | ... | <plugin> | <groupId>org.myco.myplugins</groupId> | <artifactId>myplugin</artifactId>
            | | <configuration> | <tomcatLocation>${tomcatPath}</tomcatLocation> | </configuration>
            | </plugin> | ... | | NOTE: If you just wanted to inject this configuration
            whenever someone set ‘target-env‘ to | anything, you could just leave off
            the <value/> inside the activation-property. | <profile> <id>env-dev</id>
            <activation> <property> <name>target-env</name> <value>dev</value> </property>
            </activation> <properties> <tomcatPath>/path/to/tomcat/instance</tomcatPath>
            </properties> </profile> -->
    </profiles>
时间: 2024-08-03 11:22:23

【转】新建maven工程为什么jdk会是默认版本 而不是自己设置的版本?的相关文章

正确新建maven工程2

网上看到许多新建maven工程的文章,都比较老了,而且没讲清楚. 尤其是Cannot change version of project facet Dynamic web module to 3.0 这个问题,有些解决办法不是很好. 下面给大家讲讲如何正确地新建maven工程,以及为什么不能转成Dynamic web module3.0. 假设大家对eclipse都比较熟悉了,话不多说,请看图: 过滤器里输入web.我们要新建一个web工程. 新生成的工程默认的jdk和compiler是1.5

新建maven工程时pom.xml报错

新建maven工程时,pom.xml报错:第一行报如下错误:multiple annotations found at this line后添加org.eclipse.m2e相关的plugin配置后,错误消失,完整pom.xml如下: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schem

SSM学习-新建Maven工程

1.创建Maven工程 1.1 用elcipse新建一个简单的maven工程 1.2 设置maven工程的setting.xml配置文件 setting.xml配置如下 <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2

新建Maven工程

这个如果不勾选那个Create a simple project也可以,但是创建完成后还需要修改工程的packaging为pom.还有如果不勾选,就选择maven-archetype-quickstart. 这里说明一下,这个packaging需要选择pom,因为这个maven project就是个模块化管理的,它自己实际上没有实际的内容的,只是包含了其它的模块.那么这里的新建时候有个src的文件夹可以直接删除. 下一步右键这个maven工程, 然后选择Maven Module 这里不用勾选这个

maven工程指定jdk版本

方法1: 在conf文件夹下找到settings.xml在profiles 节点下增加: <profile> <id>jdk-1.7</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source>

解决新建maven工程没有web.xml的问题

首先确定创建maven工程时选择的打包方式为 war 创建后如图所示没有web.xml文件以及相关文件夹,错误信息:缺少web.xml文件 解决方法: 右击maven项目,找到ProjectFacets 取消选中 Dynamic Web Module选项,点击应用,再选中Dyanmic Web Module会出现一个选项卡 点击弹出的选项卡后 输入src/main/webapp点击OK web.xml已经出现,错误信息也消除了. 原文地址:https://www.cnblogs.com/chen

eclipse新建Maven工程时Nexus Indexer为空问题

安装配置完Maven和Nexus后(可参照http://blog.csdn.net/kingzone_2008/article/details/39454873),使用mvn命令行可以创建工程骨架:但使用eclipse存在如下问题. 问题截图如下图0: 图0. Nexus Indexer为空 由于Catalog选Nexus Indexer没有可用骨架列表,先试一下Internal的骨架,选择maven-archetype-webapp后,点击Finish.报错信息如图1所示. 从下图报错可以看出

新建maven工程时报错:无法下载maven-archetype-quickstart

一.解决思路:下载最新版maven-archetype-quickstart-1.1.jar http://mvnrepository.com/artifact/org.apache.maven.archetypes/maven-archetype-quickstart/1.1\ 2.cmd窗口执行mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-quicksta

android maven eclipse里面新建maven工程The desired archetype does not exist

这个问题头疼死我了 重新配置下你看我的教程 我选的是local一直不出现最后的界面什么platform 16 等 这里一定要选择all catalogs这样过滤android出来的才有平台.到这里新建就不会有错误了 新手请多多指教