Maven Add local jar Package

Source: Internet
Author: User

Manually add the jar package to our MAVEN project.

1, first I create a Lib folder in the project root directory, the jar package is copied to the Lib folder

2. Then we configure the Pom.xml in Maven

<groupId>Org.wltea.analyzer</groupId>  <Artifactid>Ikanalyzer</Artifactid>  <version>2012ff_u1</version>  <Scope>System</Scope>  <Systempath>${project.basedir}/lib/ikanalyzer2012ff_u1.jar</Systempath>  

eg. the source code I added locally  
      <!--NPL local so -        <Dependency>            <groupId>Com.netease.npl</groupId>            <Artifactid>Npl</Artifactid>            <version>0.0.1</version>            <Scope>System</Scope>            <Systempath>${project.basedir}/lib/qasystem.jar</Systempath>        </Dependency>        <Dependency>            <groupId>Edu.stanford.nlp</groupId>            <Artifactid>Nlp</Artifactid>            <version>3.5.2</version>            <Scope>System</Scope>            <Systempath>${project.basedir}/lib/stanford-segmenter-3.5.2.jar</Systempath>        </Dependency>

3, here GroupID and Artifactid and version are can be filled out, scope must be filled out as system, and systempath we now our Jar package address can be

4. Finally, we must add our jar package to the MAVEN packaging process. Because this jar is needed when the project is running, and we have to copy it in the Web-inf/lib directory

<groupId>Org.apache.maven.plugins</groupId>  <Artifactid>Maven-war-plugin</Artifactid>  <Configuration>      <webresources>          <Resource>              <Directory>${project.basedir}/lib</Directory>              <TargetPath>Web-inf/lib</TargetPath>              <filtering>False</filtering>              <includes>                  <include>**/*.jar</include>              </includes>          </Resource>      </webresources>  </Configuration>  <version>2.1.1</version> 

eg I add the source code in the local
            <!--load local jar package -            <plugin>                <groupId>Org.apache.maven.plugins</groupId>                <Artifactid>Maven-war-plugin</Artifactid>                <Configuration>                    <webresources>                        <Resource>                            <Directory>${project.basedir}/lib</Directory>                            <TargetPath>Web-inf/lib</TargetPath>                            <filtering>False</filtering>                            <includes>                                <include>**/*.jar</include>                            </includes>                        </Resource>                    </webresources>                </Configuration>                <version>2.1.1</version>

Maven Add local jar Package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.