maven必用插件 tomcat热部署 以及 指定jdk版本

来源:互联网 发布:阿里云服务器下载文件 编辑:程序博客网 时间:2024/06/06 08:45

maven热部署:

编译插件 指定JDK版本和编码

源码打包插件

            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-source-plugin</artifactId>                <executions>                    <execution>                        <id>attach-sources</id>                        <goals>                            <goal>jar</goal>                        </goals>                    </execution>                </executions>            </plugin>
            tomcat热部署插件。 使用 tomcat:run -Dmaven.tomcat.port=8080 指令发布
            <plugin>                <groupId>org.apache.tomcat.maven</groupId>                <artifactId>tomcat7-maven-plugin</artifactId>                <version>2.1</version>                <executions>                    <execution>                        <id>tomcat-deploy</id>                        <phase>deploy</phase>                        <goals>                            <goal>deploy</goal>                        </goals>                    </execution>                </executions>                <configuration>                    <path>/</path>                    <!--访问路径 -->                    <contextReloadable>true</contextReloadable>                </configuration>            </plugin>



指定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>1.7</maven.compiler.source>        <maven.compiler.target>1.7</maven.compiler.target>        <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>    </properties></profile>
方法2:

工程设定就是在你maven工程的pom.xml文件中加入plugin:

    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <version>3.1</version>                <configuration>                    <source>1.7</source>                    <target>1.7</target>                    <encoding>UTF-8</encoding>                </configuration>            </plugin>        </plugins>    </build>




0 0
原创粉丝点击