简体   繁体   English

如何在Spring Boot项目中添加多个本地罐子作为依赖项

[英]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.

相关问题 如何在另一个Spring启动项目中添加本地spring启动项目作为依赖项 - How to add local spring boot project as a dependency in another spring boot project 如何在 maven 项目中添加 talend jars 依赖 - How to add talend jars dependency in maven project Spring Heroku 中的引导项目作为对另一个本地 Spring 引导项目的依赖项? - Spring boot project in Heroku as dependency to another local Spring Boot project? 如何在Maven项目中添加70个本地jar? - How to add 70 local jars on maven project? 如何在 spring-boot 项目中向 pom.xml 添加非 spring-boot 依赖 - How to add a non-spring-boot dependency to the pom.xml in a spring-boot project 如何在不改变原有pom的情况下,在新的spring-boot项目中添加spring-boot jar作为依赖 - How to add a spring-boot jar as a dependency in a new spring-boot project without changing the original pom 如何在 Jenkins 中添加依赖 JARs 以构建 Maven 项目? - How to add dependency JARs for building Maven project in Jenkins? 将 spring boot maven 项目作为依赖添加到另一个项目(本地) - Add spring boot maven project as dependency to another project (locally) 本地简单项目如何使用Spring boot? - How to use Spring boot for local simple project? 无法将 JPA 依赖项添加到 spring-boot 项目中 - Not able to add JPA dependency into spring-boot project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM