IDEA 使用maven將第三方jar打包進程序

1.添中第三方包

在程序 pom.xml 加入第三方包,指定包含路徑

<dependencies>
    <!--PLC通訊-->
    <dependency>
        <groupId>jamod</groupId>
        <artifactId>jamod</artifactId>
        <version>1.2</version>
        <scope>system</scope>
        <systemPath>${basedir}/src/lib/jamod-1.2-SNAPSHOT.jar</systemPath>
    </dependency>
</dependencies>

scope設成 system,  添加 systemPath 設置第三方包的路徑

 

2.修改maven插件配置

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <executable>true</executable>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
    </plugins>
    <finalName>Timo-${project.version}</finalName>
</build>

記得在maven插件下面加入 configuration 設置,表示打包時需查找system目錄程序進行打包.

 

3.備註

到於在 Project Structure 裏面添加模塊,我這邊沒有進行設置也能正常打包並運行.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章