如何在Spring Boot项目中添加多个本地罐子作为依赖项
我有以下问题.
我应该在我的spring boot项目中添加很多本地jar(超过200个文件)作为依赖项.
I should add a lot of local jars(more than 200 files) into my spring boot project as dependency.
所以我不想在pom 200中拥有
So I dont want to have in my pom 200
<dependency>
<groupId>com.bla</groupId>
<artifactId>testId</artifactId>
<version>0.1.0</version>
</dependency>
我尝试过
<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>
在这种情况下,Intellij IDEA可以看到jar,但是如果我在结果jar中编译项目,则只有lib文件夹,而项目中没有我自己的类,而Spring Boot中没有文件.
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.
我也尝试过这种变体:
<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.
我想问题是带有"include"部分的spring-boot-maven-plugin和maven-compiler-plugin不能一起工作.
I guess the problem is that the spring-boot-maven-plugin and maven-compiler-plugin with "include" section dont work together.
我最后一次尝试是:
<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>
我问你不建议我在本地Maven存储库中安装jar,因为我不想在我的pom.xml 200依赖项中安装它.
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.
预先感谢
如何使用此插件添加用于构建项目的依赖项:
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.