使用其他文件和依赖项打包Spring-boot应用程序

时间:2019-02-20 20:11:54

标签: maven spring-boot

我需要使用其他文件(测试类)和其他依赖项(Junit)来打包Spring Boot应用程序。
我尝试使用maven-assembly-plugin,但运行命令:     java -jar ./target/demo-0.0.1-SNAPSHOT-fat-tests.jar
因错误而失败:
No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.

这是我在pom.xml中的插件:

<plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.1.1</version>
            <configuration>

                <descriptors>
                    <descriptor>src/main/assembly/assembly.xml</descriptor>
                </descriptors>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.example.demo.DemoApplication</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> <!-- this is used for inheritance merges -->
                    <phase>package</phase> <!-- bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

我实际上是在寻找一些模仿spring-boot-maven-plugin并具有允许您添加自己的其他文件和依赖项的灵活性的插件。

0 个答案:

没有答案