• Maven环境搭建、调试、打包


    1、配置Maven环境

    将下载文件解压,然后设置maven环境
    新建环境变量M2_HOME

    变量名:M2_HOME

    变量值:F:mavenapache-maven-3.0.3

    追加path环境变量 

    找到path其变量值尾部加入:;%M2_HOME%in;---前面注意分号

    2、修改仓库位置

    我的仓库路径:F:maven epo----这个路径是我自己创建,你可以将路径创建在任何位置。
    我们打开…apache-maven-3.0.3conf目录下的setting.xml文件,设置成我们创建的仓库路径
      <!-- localRepository
       | The path to the local repository maven will use to store artifacts.
       |
       | Default: ${user.home}/.m2/repository
    -->
      <localRepository>F:mavenm2 epository</localRepository>

    3、导入eclipse开发工具

    先配置maven仓库路径

    Window----Perferences-----java-----Build Path-----Classpath Variables

    New一个变量的类路径。

    注:如果已有该变量则修改如下图:

     

    4、Eclipse中添加jetty-plugin(用于调试运行)

         1)、在pom.xml中添加如下配置

          ......<plugin>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>maven-jetty-plugin</artifactId>
                    <version>6.1.5</version>
                    <configuration>
                        <webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
                        <scanIntervalSeconds>3</scanIntervalSeconds>
                        <contextPath>/payment</contextPath>
                        <connectors>
                            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                <port>8088</port>
                            </connector>
                        </connectors>
                    </configuration>
                </plugin>
            </plugins>

        2)、Eclipse中配置Run Configurations

               

    5、maven项目打包

         1)、pom.xml文件中添加配置 

            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>tomcat-maven-plugin</artifactId>
                    <configuration>
                        <warFile>target/payment.war</warFile>
                    </configuration>
                </plugin>
                <!-- 打包到远程 -->
                <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> 
                    <configuration> <url>http://远程地址/payment</url> <server>test</server> <path>/</path> 
                    </configuration> </plugin> 
    -->

         2)、执行打包

         命令窗口到你的project目录执行命令:mvn package 

    坚持,坚持,再坚持。
  • 相关阅读:
    论线段树:二
    BST 二叉搜索树
    论线段树:一
    [luoguP3627][APIO2009]抢掠计划
    二分图匹配(匈牙利算法)
    SPFA 全面讲解
    markdown的常用高级操作。
    UVA11235 Frequent values
    P2279 [HNOI2003]消防局的设立
    P2216 [HAOI2007]理想的正方形
  • 原文地址:https://www.cnblogs.com/walk-the-Line/p/4904313.html
Copyright © 2020-2023  润新知