[英]How to add in spring boot project multiple local jars as dependency
I have followings problem. 我有以下问题。
I should add a lot of local jars(more than 200 files) into my spring boot project as dependency. 我应该在我的spring boot项目中添加很多本地jar(超过200个文件)作为依赖项。
So I dont want to have in my pom 200 所以我不想在pom 200中
<dependency>
<groupId>com.bla</groupId>
<artifactId>testId</artifactId>
<version>0.1.0</version>
</dependency>
I tried with 我尝试过
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<useIncrementalCompilation>false</useIncrementalCompilation>
<includes>
<include>${basedir}/src/main/resources/lib/*.jar</include>
</includes>
</configuration>
</plugin>
In this case Intellij IDEA can see the jars, but if I compile the project in result jar there is only lib folder without my own classes from project and without files from spring boot. 在这种情况下,Intellij IDEA可以看到jar,但是如果我在结果jar中编译项目,则只有lib文件夹,而项目中没有我自己的类,而Spring Boot中没有文件。
I tried with this variante too: 我也尝试过这种变体:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<useIncrementalCompilation>false</useIncrementalCompilation>
<includes>
<include>${basedir}/src/main/java/**/*.java</include>
<include>${basedir}/src/main/resources/lib/*.jar</include>
</includes>
</configuration>
</plugin>
Unfortunately it doesn't work. 不幸的是,它不起作用。
I guess the problem is that the spring-boot-maven-plugin and maven-compiler-plugin with "include" section dont work together. 我想问题是带“ include”部分的spring-boot-maven-plugin和maven-compiler-plugin不能一起工作。
My last try was : 我最后的尝试是:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<useIncrementalCompilation>false</useIncrementalCompilation>
<includes>
<include>${basedir}/src/main/java/**/*.java</include>
<include>${basedir}/src/main/resources/lib/*.jar</include>
</includes>
</configuration>
</plugin>
I ask you don't suggest me to install the jars in local maven repository because I dont want to have in my pom.xml 200 dependencies. 我问你不要建议我在本地Maven存储库中安装jar,因为我不想在pom.xml 200中具有依赖项。
Thank in advance 预先感谢
How about using this plugins to add dependencies for building the project: 如何使用此插件添加用于构建项目的依赖项:
<plugin>
<groupId>com.googlecode.addjars-maven-plugin</groupId>
<artifactId>addjars-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<goals>
<goal>add-jars</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${your_jars_folder}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
And you could add the folder to your project library settings for developing. 您可以将该文件夹添加到项目库设置中进行开发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.