1. Download and decompress Maven to a local directory

D: \ apache maven — 3.3.9

2. Configure the Maven local repository

Open the D: \ apache maven – 3.3.9 \ conf \ Settings XML

Add near line 55:

d:\Library\maven-repo

Add near line 213:

<profile> < ID > JDK-1.8 </ ID > <activation> <activeByDefault>true</activeByDefault> < JDK >1.8</ JDK > </activation> Piler < properties > < maven.com. Source > 1.8 < / maven.com piler source > < maven.com piler. Target > 1.8 < / maven.com piler. Target > The < maven.compiler.com pilerVersion > 1.8 < / maven.compiler.com pilerVersion > < / properties > < / profile >Copy the code

3. Add a custom JAR to the local repository

D: \ apache maven – 3.3.9 \ bin > MVN install: install – file – Dfile = C: / Users/leizm/Desktop/ansj_seg – 5.0.0 – all – in – one. The jar -dgroupid =org. ansj-dartifactid = ansj_seg-dversio n=5.0.0 -dpackaging =jar

So the dependency configuration in POM.xml is:

Run the following command:

D: \ apache maven – 3.3.9 \ bin > MVN install: install – file – Dfile = C: / Users/leizm/Desktop/ansj_seg – 5.0.0 – all – in – one. The jar -dgroupid =org. ansj-dartifactid = ansj_seg-dversio n=5.0.0 -dpackaging =jar [INFO] Scanning for projects… [INFO] [INFO] ———————————————————————— [INFO] Building Maven Stub Project (No POM) 1 [INFO] ———————————————————————— [INFO] [INFO] — Maven — install plugin: 2.4: install – file (default – cli) @ standalone – pom

[INFO] Installing C:\Users\leizm\Desktop\ansj_seg-5.0.0-all-in-one. Jar to D :\Lib Rary \ maven repo – \ org \ ansj \ ansj_seg \ 5.0.0 \ ansj_seg – 5.0.0 jar [INFO] Installing C:\Users\leizm\AppData\Local\Temp\mvninstall158649410227741988 1.pom to D: \ Library \ maven repo – \ org \ ansj \ ansj_seg \ 5.0.0 \ ansj_seg – 5.0.0 pom/INFO ———————————————————————— [INFO] BUILD SUCCESS [INFO] — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — [INFO] Total time: 0.793 s [INFO] Finished at: 2016-07-04T17:15:43+08:00 [INFO] Final Memory: 8M/241M [INFO] ————————————————————————

D: \ apache maven – 3.3.9 \ bin >

4. Present an actual POM.xml file

4.0.0 com. LFW LFWSV war 1.0-SNAPSHOT LFWSV Maven Webapp maven.apache.org ASM 3.3.1 AopAlliance AopAlliance 1.0 Org.aspectj AspectJrt 1.8.4 org.aspectJ AspectJweaver 1.7.3 cglib cglib 2.2.2 commons-logging commons-logging 1.1.3 Org.slf4j slf4j-API 1.7.5 org.slf4j slf4j-log4j12 1.7.5 log4j log4j 1.2.17 dom4j dom4j 1.6.1 xmL-apis xmL-apis 1.1.b2 Commons – Beanutils Commons – Beanutils 1.8.3 Commons -cli Commons -cli 1.1 Commons -collections Commons -collections 3.2.1 Commons -codec Commons -codec 1.10 Commons – DBCP Commons – DBCP 1.4 Commons -fileupload Commons -fileupload 1.3.1 Commons – IO Commons – IO 2.4 Commons -lang Commons -lang 2.6 Commons -pool Commons -pool 1.6 org.apache.commons Commons -pool2 2.3

    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache-core</artifactId>
        <version>2.5.0</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.11</version>
    </dependency>

    <!-- alibaba连接池-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.0.19</version>
    </dependency>
    <!--junit-->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-core</artifactId>
        <version>1.3</version>
    </dependency>

    <!--jackson-->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-jaxb-annotations</artifactId>
        <version>2.3.1</version>
    </dependency>
    <!--mybatis-->
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis</artifactId>
        <version>3.2.8</version>
    </dependency>
    <dependency>
        <groupId>org.mybatis</groupId>
        <artifactId>mybatis-spring</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.38</version>
    </dependency>

    <!--spring-->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-instrument</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-instrument-tomcat</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-oxm</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.2.12.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
        <version>1.4.2.RELEASE</version>
    </dependency>

    <!-- poi-->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.11</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
    </dependency>

    <!-- itext-->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.4.5</version>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext-asian</artifactId>
        <version>5.2.0</version>
    </dependency>

    <!-- freemarker-->
    <dependency>
        <groupId>freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.2</version>
    </dependency>

    <!-- httpclient-->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient-cache</artifactId>
        <version>4.4.1</version>
    </dependency>

    <!--工具包-->
    <dependency>
        <groupId>com.github.cage</groupId>
        <artifactId>cage</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>net.coobird</groupId>
        <artifactId>thumbnailator</artifactId>
        <version>0.4.8</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.190</version>
    </dependency>
    <dependency>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
        <version>2.6.2</version>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0</version>
    </dependency>
    <dependency>
        <groupId>framework</groupId>
        <artifactId>framework</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.ansj</groupId>
        <artifactId>ansj_seg</artifactId>
        <version>5.0.0</version>
    </dependency>
</dependencies>

<!-- 发布路径-->
<!--<distributionManagement>-->
<!--&lt;!&ndash; 正式版发布路径&ndash;&gt;-->
<!--<repository>-->
<!--<id>nexus-releases</id>-->
<!--<name>Nexus Release Repository</name>-->
<!--<url>http://192.168.1.200:8081/nexus/content/repositories/releases/</url>-->
<!--</repository>-->
<!--&lt;!&ndash; 快照版发布路径&ndash;&gt;-->
<!--<snapshotRepository>-->
<!--<id>nexus-snapshots</id>-->
<!--<name>Nexus Snapshot Repository</name>-->
<!--<url>http://192.168.1.200:8081/nexus/content/repositories/snapshots/</url>-->
<!--</snapshotRepository>-->
<!--</distributionManagement>-->

<properties>
    <!-- 文件拷贝时的编码 -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <!-- 编译时的编码 -->
    <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>

<build>
    <finalName>lfwsv</finalName>

    <!-- 声明不需要web.xml-->
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>utf-8</encoding>
            </configuration>
        </plugin>
        <!--<plugin>-->
        <!--<groupId>org.apache.maven.plugins</groupId>-->
        <!--<artifactId>maven-war-plugin</artifactId>-->
        <!--<configuration>-->
        <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
        <!--</configuration>-->
        <!--</plugin>-->
    </plugins>
    <!-- 设置xml文件打包时保留-->
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>
Copy the code