Maven用法

来源:互联网 发布:雄猫软件 编辑:程序博客网 时间:2024/06/04 00:23

1.    下载apache-maven-3.2.5

2.    配置mavne环境变量



 

测试maven环境变量配置



 

3.    Eclipse与maven建立关联




4.    Settings.xml配置【配置本地仓库】

 

<?xmlversion="1.0" encoding="UTF-8"?>

 

<!--

Licensedto the Apache Software Foundation (ASF) under one

or morecontributor license agreements.  See theNOTICE file

distributedwith this work for additional information

regardingcopyright ownership.  The ASF licensesthis file

to youunder the Apache License, Version 2.0 (the

"License");you may not use this file except in compliance

with theLicense.  You may obtain a copy of theLicense at

 

    http://www.apache.org/licenses/LICENSE-2.0

 

Unlessrequired by applicable law or agreed to in writing,

softwaredistributed under the License is distributed on an

"ASIS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

KIND,either express or implied.  See theLicense for the

specificlanguage governing permissions and limitations

under theLicense.

-->

 

<!--

 | This is the configuration file for Maven. Itcan be specified at two levels:

 |

 |  1.User Level. This settings.xml file provides configuration for a single user,

 |                 and is normally provided in${user.home}/.m2/settings.xml.

 |

 |                 NOTE: This location can beoverridden with the CLI option:

 |

 |                 -s /path/to/user/settings.xml

 |

 |  2.Global Level. This settings.xml file provides configuration for all Maven

 |                 users on a machine (assumingthey're all using the same Maven

 |                 installation). It's normallyprovided in

 |                ${maven.home}/conf/settings.xml.

 |

 |                 NOTE: This location can beoverridden with the CLI option:

 |

 |                 -gs/path/to/global/settings.xml

 |

 | The sections in this sample file are intendedto give you a running start at

 | getting the most out of your Maveninstallation. Where appropriate, the default

 | values (values used when the setting is notspecified) are provided.

 |

 |-->

<settingsxmlns="http://maven.apache.org/SETTINGS/1.0.0"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <!-- localRepository

   | The path to the local repository mavenwill use to store artifacts.

   |

   | Default: ${user.home}/.m2/repository

 <localRepository>/path/to/local/repo</localRepository>

  -->

  <localRepository>C:/Users/youyidong/.m2/repository</localRepository>

 

  <!-- interactiveMode

   | This will determine whether maven promptsyou when it needs input. If set to false,

   | maven will use a sensible default value,perhaps based on some other setting, for

   | the parameter in question.

   |

   | Default: true

  <interactiveMode>true</interactiveMode>

  -->

 

  <!-- offline

   | Determines whether maven should attempt toconnect to the network when executing a build.

   | This will have an effect on artifactdownloads, artifact deployment, and others.

   |

   | Default: false

  <offline>false</offline>

  -->

 

  <!-- pluginGroups

   | This is a list of additional groupidentifiers that will be searched when resolving plugins by their prefix, i.e.

   | when invoking a command line like"mvn prefix:goal". Maven will automatically add the group identifiers

   | "org.apache.maven.plugins" and"org.codehaus.mojo" if these are not already contained in the list.

   |-->

  <pluginGroups>

    <!-- pluginGroup

     | Specifies a further group identifier touse for plugin lookup.

    <pluginGroup>com.your.plugins</pluginGroup>

    -->

  </pluginGroups>

 

  <!-- proxies

   | This is a list of proxies which can beused on this machine to connect to the network.

   | Unless otherwise specified (by systemproperty or command-line switch), the first proxy

   | specification in this list marked asactive will be used.

   |-->

  <proxies>

    <!-- proxy

     | Specification for one proxy, to be usedin connecting to the network.

     |

    <proxy>

      <id>optional</id>

      <active>true</active>

      <protocol>http</protocol>

     <username>proxyuser</username>

     <password>proxypass</password>

      <host>proxy.host.net</host>

      <port>80</port>

     <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

    </proxy>

    -->

  </proxies>

 

  <!-- servers

   | This is a list of authentication profiles,keyed by the server-id used within the system.

   | Authentication profiles can be usedwhenever maven must make a connection to a remote server.

   |-->

  <servers>

    <!-- server

     | Specifies the authentication informationto use when connecting to a particular server, identified by

     | a unique name within the system(referred to by the 'id' attribute below).

     |

     | NOTE: You should either specifyusername/password OR privateKey/passphrase, since these pairings are

     |      used together.

     |

    <server>

      <id>deploymentRepo</id>

      <username>repouser</username>

      <password>repopwd</password>

    </server>

    -->

 

    <!-- Another sample, using keys toauthenticate.

    <server>

      <id>siteServer</id>

     <privateKey>/path/to/private/key</privateKey>

      <passphrase>optional; leave emptyif not used.</passphrase>

    </server>

    -->

  </servers>

 

  <!-- mirrors

   | This is a list of mirrors to be used indownloading artifacts from remote repositories.

   |

   | It works like this: a POM may declare arepository to use in resolving certain artifacts.

   | However, this repository may have problemswith heavy traffic at times, so people have mirrored

   | it to several places.

   |

   | That repository definition will have aunique id, so we can create a mirror reference for that

   | repository, to be used as an alternatedownload site. The mirror site will be the preferred

   | server for that repository.

   |-->

  <mirrors>

    <!-- mirror

     | Specifies a repository mirror site touse instead of a given repository. The repository that

     | this mirror serves has an ID thatmatches the mirrorOf element of this mirror. IDs are used

     | for inheritance and direct lookuppurposes, and must be unique across the set of mirrors.

     |-->

    <mirror>

      <id>mirrorId</id>

     <mirrorOf>repositoryId</mirrorOf>

      <name>Human Readable Name for thisMirror.</name>

      <!--<url>http://my.repository.com/repo/path</url> -->

     <url>http://mvnrepository.com</url>

    </mirror>

    

  </mirrors>

 

  <!-- profiles

   | This is a list of profiles which can beactivated in a variety of ways, and which can modify

   | the build process. Profiles provided inthe settings.xml are intended to provide local machine-

   | specific paths and repository locationswhich allow the build to work in the local environment.

   |

   | For example, if you have an integrationtesting plugin - like cactus - that needs to know where

   | your Tomcat instance is installed, you canprovide a variable here such that the variable is

   | dereferenced during the build process toconfigure the cactus plugin.

   |

   | As noted above, profiles can be activatedin a variety of ways. One way - the activeProfiles

   | section of this document (settings.xml) -will be discussed later. Another way essentially

   | relies on the detection of a systemproperty, either matching a particular value for the property,

   | or merely testing its existence. Profilescan also be activated by JDK version prefix, where a

   | value of '1.4' might activate a profilewhen the build is executed on a JDK version of '1.4.2_07'.

   | Finally, the list of active profiles canbe specified directly from the command line.

   |

   | NOTE: For profiles defined in thesettings.xml, you are restricted to specifying only artifact

   |      repositories, plugin repositories, and free-form properties to be usedas configuration

   |      variables for plugins in the POM.

   |

   |-->

  <profiles>

    <!-- profile

     | Specifies a set of introductions to thebuild 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 have tohave an ID that is unique.

     |

     | An encouraged best practice for profileidentification 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 you onlyhave 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 JDK 1.4builds</name>

         <url>http://www.myhost.com/maven/jdk14</url>

          <layout>default</layout>

         <snapshotPolicy>always</snapshotPolicy>

        </repository>

      </repositories>

    </profile>

    -->

 

    <!--

     | Here is another profile, activated bythe system property 'target-env' with a value of 'dev',

     | which provides a specific path to theTomcat 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 thisconfiguration 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>

 

  <!-- activeProfiles

   | List of profiles that are active for allbuilds.

   |

  <activeProfiles>

   <activeProfile>alwaysActiveProfile</activeProfile>

   <activeProfile>anotherAlwaysActiveProfile</activeProfile>

  </activeProfiles>

  -->

</settings>

 

5.    maven项目中配置远程仓库 【maven项目的pom.xml文件】

 

<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.shunhe</groupId>

    <artifactId>core</artifactId>

    <packaging>war</packaging>

    <version>0.0.1-SNAPSHOT</version>

    <name>coreMaven Webapp</name>

    <url>http://maven.apache.org</url>

 

    <properties>

       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

       <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>

       <jdk.version>1.7</jdk.version>

       <spring.version>3.2.8.RELEASE</spring.version>

       <hibernate.version>3.5.5-Final</hibernate.version>

       <CKFinder.version>2.4</CKFinder.version>

       <spring.security.version>3.2.5.RELEASE</spring.security.version>

    </properties>

    <dependencies>

       <dependency>

           <groupId>junit</groupId>

           <artifactId>junit</artifactId>

           <version>3.8.1</version>

           <scope>test</scope>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-context</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-context-support</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-jdbc</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-webmvc</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-aop</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-test</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-web</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-core</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-expression</artifactId>

           <version>${spring.version}</version>

       </dependency>

 

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-orm</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework</groupId>

           <artifactId>spring-tx</artifactId>

           <version>${spring.version}</version>

       </dependency>

       <dependency>

           <groupId>org.freemarker</groupId>

           <artifactId>freemarker</artifactId>

           <version>2.3.20</version>

        </dependency>

 

       <dependency>

           <groupId>org.hibernate</groupId>

           <artifactId>hibernate-core</artifactId>

           <version>${hibernate.version}</version>

       </dependency>

       <dependency>

           <groupId>org.hibernate</groupId>

           <artifactId>hibernate-annotations</artifactId>

           <version>${hibernate.version}</version>

       </dependency>

       <dependency>

           <groupId>net.sf.ehcache</groupId>

           <artifactId>ehcache-core</artifactId>

           <version>2.5.5</version>

       </dependency>

 

       <dependency>

           <groupId>org.aspectj</groupId>

           <artifactId>aspectjweaver</artifactId>

           <version>1.6.9</version>

       </dependency>

       <dependency>

           <groupId>org.slf4j</groupId>

           <artifactId>slf4j-log4j12</artifactId>

           <version>1.5.8</version>

       </dependency>

       <dependency>

           <groupId>c3p0</groupId>

           <artifactId>c3p0</artifactId>

           <version>0.9.1</version>

       </dependency>

       <dependency>

           <groupId>commons-lang</groupId>

           <artifactId>commons-lang</artifactId>

           <version>2.5</version>

       </dependency>

       <dependency>

           <groupId>mysql</groupId>

           <artifactId>mysql-connector-java</artifactId>

           <version>5.1.30</version>

       </dependency>

       <dependency>

           <groupId>org.jsoup</groupId>

           <artifactId>jsoup</artifactId>

           <version>1.7.3</version>

       </dependency>

       <dependency>

           <groupId>dom4j</groupId>

           <artifactId>dom4j</artifactId>

           <version>1.6.1</version>

           <exclusions>

              <exclusion>

                  <artifactId>xml-apis</artifactId>

                  <groupId>xml-apis</groupId>

              </exclusion>

           </exclusions>

       </dependency>

       <dependency>

           <groupId>commons-fileupload</groupId>

           <artifactId>commons-fileupload</artifactId>

           <version>1.3</version>

       </dependency>

       <dependency>

           <groupId>org.codehaus.jackson</groupId>

           <artifactId>jackson-core-lgpl</artifactId>

           <version>1.9.13</version>

       </dependency>

       <dependency>

           <groupId>org.codehaus.jackson</groupId>

           <artifactId>jackson-mapper-lgpl</artifactId>

           <version>1.9.13</version>

       </dependency>

       <dependency>

           <groupId>commons-validator</groupId>

           <artifactId>commons-validator</artifactId>

           <version>1.4.0</version>

       </dependency>

       <dependency>

           <groupId>commons-codec</groupId>

           <artifactId>commons-codec</artifactId>

           <version>1.8</version>

       </dependency>

       <dependency>

           <groupId>com.github.axet</groupId>

           <artifactId>kaptcha</artifactId>

           <version>0.0.8</version>

       </dependency>

        <dependency>

            <groupId>org.apache.poi</groupId>

            <artifactId>poi</artifactId>

            <version>3.10-FINAL</version>

        </dependency>

       <dependency>

           <groupId>com.fasterxml.jackson.dataformat</groupId>

           <artifactId>jackson-dataformat-xml</artifactId>

           <version>2.2.3</version>

       </dependency>

       <dependency>

           <groupId>net.sf.json-lib</groupId>

           <artifactId>json-lib</artifactId>

           <version>2.4</version>

           <classifier>jdk15</classifier>

       </dependency>

       <dependency>

           <groupId>org.apache.commons</groupId>

           <artifactId>commons-compress</artifactId>

           <version>1.7</version>

       </dependency>

        <dependency>

            <groupId>com.deepoove</groupId>

            <artifactId>poi-tl</artifactId>

            <version>0.0.3</version>

        </dependency>

       <dependency>

           <groupId>commons-io</groupId>

           <artifactId>commons-io</artifactId>

           <version>2.4</version>

       </dependency>

       <dependency>

           <groupId>commons-lang</groupId>

           <artifactId>commons-lang</artifactId>

           <version>2.5</version>

       </dependency>

       <dependency>

           <groupId>commons-logging</groupId>

           <artifactId>commons-logging</artifactId>

           <version>1.1</version>

           <exclusions>

              <exclusion>

                  <artifactId>servlet-api</artifactId>

                  <groupId>javax.servlet</groupId>

              </exclusion>

           </exclusions>

       </dependency>

       <dependency>

           <groupId>commons-collections</groupId>

           <artifactId>commons-collections</artifactId>

           <version>3.2.1</version>

       </dependency>

 

       <dependency>

           <groupId>org.imgscalr</groupId>

           <artifactId>imgscalr-lib</artifactId>

           <version>4.2</version>

           <!-- apache图片组件 -->

       </dependency>

       <dependency>

           <groupId>com.cloudhopper.proxool</groupId>

           <artifactId>proxool-cglib</artifactId>

           <version>0.9.1</version>

       </dependency>

       <dependency>

           <groupId>com.cloudhopper.proxool</groupId>

           <artifactId>proxool</artifactId>

           <version>0.9.1</version>

           <exclusions>

              <exclusion>

                  <artifactId>commons-logging</artifactId>

                  <groupId>commons-logging</groupId>

              </exclusion>

              <exclusion>

                  <artifactId>geronimo-spec-javamail</artifactId>

                  <groupId>geronimo-spec</groupId>

              </exclusion>

               <exclusion>

                  <artifactId>geronimo-spec-jms</artifactId>

                  <groupId>geronimo-spec</groupId>

              </exclusion>

              <exclusion>

                  <groupId>javax.servlet</groupId>

                  <artifactId>javax.servlet-api</artifactId>

              </exclusion>

              <exclusion>

                  <artifactId>servlet-api</artifactId>

                  <groupId>javax.servlet</groupId>

              </exclusion>

           </exclusions>

       </dependency>

       <dependency>

           <groupId>javax.servlet</groupId>

           <artifactId>javax.servlet-api</artifactId>

           <scope>provided</scope>

           <version>3.1.0</version>

       </dependency>

       <dependency>

           <groupId>org.springframework.mobile</groupId>

           <artifactId>spring-mobile-device</artifactId>

           <version>1.1.2.RELEASE</version>

       </dependency>

       <dependency>

           <groupId>javax.mail</groupId>

           <artifactId>mail</artifactId>

           <version>1.4.4</version>

       </dependency>

       <dependency>

           <groupId>org.quartz-scheduler</groupId>

           <artifactId>quartz</artifactId>

           <version>2.2.1</version>

       </dependency>

       <dependency>

           <groupId>net.sf.ehcache</groupId>

           <artifactId>ehcache-core</artifactId>

           <version>2.5.5</version>

       </dependency>

       <dependency>

           <groupId>javassist</groupId>

           <artifactId>javassist</artifactId>

           <version>3.9.0.GA</version>

       </dependency>

       <dependency>

           <groupId>jstl</groupId>

           <artifactId>jstl</artifactId>

           <version>1.2</version>

       </dependency>

       <dependency>

           <groupId>com.ckfinder</groupId>

           <artifactId>CKFinder</artifactId>

           <version>${CKFinder.version}</version>

       </dependency>

       <dependency>

           <groupId>com.ckfinder</groupId>

           <artifactId>CKFinderPlugin-FileEditor</artifactId>

           <version>${CKFinder.version}</version>

       </dependency>

       <dependency>

           <groupId>com.ckfinder</groupId>

           <artifactId>CKFinderPlugin-ImageResize</artifactId>

           <version>${CKFinder.version}</version>

       </dependency>

       <dependency>

           <groupId>com.ckfinder</groupId>

           <artifactId>CKFinderPlugin-Watermark</artifactId>

           <version>${CKFinder.version}</version>

       </dependency>

       <dependency>

           <groupId>net.coobird</groupId>

           <artifactId>thumbnailator</artifactId>

           <version>0.4.7</version>

       </dependency>

       <dependency>

           <groupId>org.jboss</groupId>

           <artifactId>jboss-vfs</artifactId>

           <version>3.1.0.Final</version>

       </dependency>

       <dependency>

           <!--alipay使用 -->

           <groupId>commons-httpclient</groupId>

           <artifactId>commons-httpclient</artifactId>

           <version>3.0.1</version>

       </dependency>

       <dependency>

           <groupId>org.springframework.security</groupId>

           <artifactId>spring-security-core</artifactId>

           <version>${spring.security.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework.security</groupId>

           <artifactId>spring-security-config</artifactId>

           <version>${spring.security.version}</version>

       </dependency>

       <dependency>

           <groupId>org.springframework.security</groupId>

           <artifactId>spring-security-web</artifactId>

           <version>${spring.security.version}</version>

       </dependency>

       <dependency>

           <groupId>com.shunhe</groupId>

           <artifactId>sh-core</artifactId>

           <version>1.0</version>

       </dependency>

       <dependency>

           <groupId>com.shunhe</groupId>

           <artifactId>sh-base</artifactId>

           <version>1.0</version>

       </dependency>

       <dependency>

           <groupId>com.shunhe</groupId>

           <artifactId>sh-cms</artifactId>

           <version>1.0</version>

       </dependency>

       <dependency>

           <groupId>com.google.zxing</groupId>

           <artifactId>core</artifactId>

           <version>3.2.0</version>

       </dependency>

       <dependency>

           <groupId>com.google.zxing</groupId>

           <artifactId>javase</artifactId>

           <version>3.2.0</version>

       </dependency>

       <!-- <dependency>

            <groupId>org.apache.cxf</groupId>

             <artifactId>apache-cxf</artifactId>

            <version>2.4.3</version>

             <type>pom</type>

       </dependency> -->

      

       <!-- <dependency>

            <groupId>org.apache.cxf</groupId>

             <artifactId>cxf-bundle</artifactId>

            <version>2.4.3</version>

             <type>pom</type>

       </dependency> -->

      

       <!--<dependency> 

          <groupId>org.apache.axis2</groupId> 

           <artifactId>axis2</artifactId> 

          <version>1.5.4</version> 

       </dependency> 

       <dependency> 

          <groupId>org.apache.ws.commons.axiom</groupId> 

          <artifactId>axiom-api</artifactId> 

          <version>1.2.10</version> 

       </dependency> 

       <dependency> 

          <groupId>org.apache.ws.commons.axiom</groupId> 

          <artifactId>axiom-impl</artifactId> 

          <version>1.2.10</version> 

       </dependency> 

       <dependency>

          <groupId>org.apache.xmlbeans</groupId>

           <artifactId>xmlbeans</artifactId>

          <version>2.5.0</version>

       </dependency>

        

       <dependency> 

          <groupId>org.apache.axis2</groupId> 

          <artifactId>axis2-transport-http</artifactId> 

          <version>1.5</version> 

       </dependency> 

       <dependency> 

          <groupId>org.apache.axis2</groupId> 

          <artifactId>axis2-transport-local</artifactId> 

          <version>1.5</version> 

       </dependency> -->

       <dependency>

          <groupId>org.apache.httpcomponents</groupId>

          <artifactId>httpclient</artifactId>

          <version>4.2</version>

        </dependency>

        <dependency>

          <groupId>org.apache.httpcomponents</groupId>

          <artifactId>httpmime</artifactId>

          <version>4.2</version>

        </dependency>

        <dependency>

          <groupId>org.apache.httpcomponents</groupId>

          <artifactId>httpcore</artifactId>

          <version>4.2</version>

        </dependency>

      

       <dependency>

             <groupId>bcprov</groupId>

             <artifactId>bcprov-jdk16</artifactId>

             <version>1.0</version>

        </dependency>

      

       <dependency>

             <groupId>ips</groupId>

             <artifactId>ips-security-utility</artifactId>

             <version>1.0</version>

       </dependency>

           <dependency>

             <groupId>com.baidu</groupId>

             <artifactId>baidu_yun_push</artifactId>

             <version>1.0</version>

       </dependency>

       <!-- 中金配置 -->

       <!-- <dependency>

            <groupId>payment</groupId>

            <artifactId>payment-jdk1.6</artifactId>

            <version>1.0</version>

       </dependency>

       <dependency>

            <groupId>tools</groupId>

            <artifactId>tools-1.5.3</artifactId>

            <version>1.0</version>

       </dependency>

        -->

       <dependency>

             <groupId>cpcn-payment</groupId>

             <artifactId>cpcn-payment-api</artifactId>

             <version>1.0</version>

       </dependency>

       <dependency>

             <groupId>tools</groupId>

             <artifactId>tools-1.5.7</artifactId>

             <version>1.0</version>

       </dependency>

      

       <dependency>

             <groupId>jdom</groupId>

             <artifactId>jdom-2.0.2</artifactId>

             <version>1.0</version>

       </dependency>

 

    </dependencies>

<!--   <repositories>

       <repository>

           <id>repo</id>

           <releases>

              <enabled>true</enabled>

              <checksumPolicy>ignore</checksumPolicy>

           </releases>

           <snapshots>

              <enabled>false</enabled>

           </snapshots>

           <url>file://${project.basedir}/lib</url>

       </repository>

    </repositories> -->

    <repositories>

       <repository>

           <id>spring-releases</id>

           <url>https://repo.spring.io/libs-release</url>

       </repository>

    </repositories>

    <build>

       <finalName>core</finalName>

       <plugins>

           <plugin>

              <groupId>org.apache.maven.plugins</groupId>

              <artifactId>maven-compiler-plugin</artifactId>

              <version>3.1</version>

              <configuration>

                  <encoding>UTF-8</encoding>

                  <source>1.7</source>

                  <target>1.7</target>

                  <meminitial>512m</meminitial>

                  <maxmem>1024m</maxmem>

                  <fork>true</fork>

              </configuration>

           </plugin>

           <plugin>

              <!-- 源码插件 -->

              <groupId>org.apache.maven.plugins</groupId>

              <artifactId>maven-source-plugin</artifactId>

              <version>2.1</version>

              <!-- 发布时自动将源码同时发布的配置 -->

              <executions>

                  <execution>

                     <id>attach-sources</id>

                     <goals>

                         <goal>jar</goal>

                     </goals>

                  </execution>

              </executions>

           </plugin>

       </plugins>

    </build>

</project>

 

 

Maven创建普通工程并打包

 

1.创建普通工程

 

2.打包:

 

Maven web工程pom.xml中增加tomcat插件

 

 <build>

    <finalName>webmaven</finalName>

    <plugins>

      <plugin>

        <groupId>org.apache.tomcat.maven</groupId>

        <artifactId>tomcat8-maven-plugin</artifactId>

         <version>2.2</version>

      </plugin>

    </plugins>

  </build>

 

 

 

 

 

 

 

 

 

 

 

Pom.xml文件中添加maven-tomcat插件后,cmd进入指定的工程下通过mvn tomcat:run进行启动tomcat,可通过ctrl+c结束tomcat

 

0 0
原创粉丝点击