The introduction of external jar package when the package maven project

The company recently reconstructed old project code, the jar package through maven management, some packages do not exist in the maven repository, so by local maven jar will hit the final package.

        <!--淘宝大鱼-->
        <dependency>
            <groupId>com.taobao</groupId>
            <artifactId>taobao-sdk-java-auto</artifactId>
            <systemPath>${project.basedir}/lib/taobao-sdk-java-auto_1455552377940-20160816.jar</systemPath>
            <version>1455552377940-20160816</version>
            <scope>system</scope>
        </dependency>

Under the node pom build file must increase the allocation of resources, or will not play into the jar.

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <targetPath>BOOT-INF/classes/</targetPath>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Wherein each label meanings:

  • dependency: dependency each packet corresponds to a jar.
  • groupId: a globally unique identifier of the item, usually distinguish between the project and other projects using the fully qualified package name. And constructing paths are generated to thereby generate, as the relative path is generated com.mycompany.app: / com / mycompany / app
  • artifactId: an identifier member, together with its group ID and uniquely identifies a member. In other words, you can not have two different projects have the same artifact ID and groupID; in a particular group ID, artifact ID must be unique. Is a member of something or generated by the project, Maven is a component generated by the project include: JARs, source code, binary distribution and WARs and so on.
  • systemPath: System Path
  • version: The current version of the project in the format: major version minor version increment version - limited edition number.
  • scope: maven believes that reliance on external programs will increase as the stage program and application scenarios vary, so maven dependencies of limited scope (scope) of. scope comprising the values: compile (compile range), provided (provided range), runtime (running range), test (test range), system (system-wide)
  • $ {Project.basedir}: Project base path
  • build: build information needs of the project
  • resources: This element describes the path a list of all project-related resources, such as files and projects related properties, these resources are included in the final package file.
  • resource: This element describes all project-related or related resource path test.
  • directory: the directory storage resource description, the path relative path POM
  • targetPath: Describes a path to the resource. The path relative target / classes directory (e.g. $ {project.build.outputDirectory}). For example, if you want a specific resource in the bag (org.apache.maven.messages), you have the element set to org / apache / maven / messages. However, if you just want to put the resources in the source directory structure, you do not need this configuration.
  • includes: list contains mode.
  • include: the pattern comprising, for example, * / .xml.
  • plugins: a list of plug-ins to use.
  • plugin: plugin element contains information describing plug-ins required.

Reference:
maven pom.xml file label of meaning
when maven project introduced package jar package can not hit the external project solutions in
Spring Boot Maven project using third-party platform SystemPath references pit encountered

Reproduced in: https: //www.jianshu.com/p/447920059af1

Guess you like

Origin blog.csdn.net/weixin_33896069/article/details/91258744
Recommended