黑马程序员技术交流社区

标题: maven配置默认使用的jdk版本 [打印本页]

作者: yqw_gz_java    时间: 2018-11-1 20:26
标题: maven配置默认使用的jdk版本
进入maven服务器配置目录conf/settings.xml,修改这个配置文件再指定<profiles>内增加如下黄色内容

<profiles>
<profile>
  <id>development</id>
  <activation>
    <jdk>1.8</jdk>
    <activeByDefault>true</activeByDefault>
  </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>
</profile>
  <!--profile
   | Specifies a set of introductions tothe build process, to be activated using one or more of the
   | mechanisms described above. Forinheritance purposes, and to activate profiles via <activatedProfiles/>
   | or the command line, profiles haveto have an ID that is unique.
   |
   | An encouraged best practice forprofile 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 tounderstand what the set of introduced profiles is attempting
   | to accomplish, particularly when youonly have a list of profile id's for debug.
   |
   | This profile example uses the JDKversion to trigger activation, and provides a JDK-specific repo.
  <profile>
    <id>jdk-1.4</id>

    <activation>
      <jdk>1.4</jdk>
    </activation>

    <repositories>
      <repository>
        <id>jdk14</id>
        <name>Repository for JDK1.4 builds</name>
        <url>http://www.myhost.com/maven/jdk14</url>
       <layout>default</layout>
       <snapshotPolicy>always</snapshotPolicy>
      </repository>
    </repositories>
  </profile>
  -->


  <!--
   | Here is another profile, activatedby the system property 'target-env' with a value of 'dev',
   | which provides a specific path tothe 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 injectthis configuration whenever someone set 'target-env' to
   |      anything, you could just leave off the <value/> inside theactivation-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>







欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2