English 中文(简体)
当我触发建设影像目标时, 弹簧启动造影插件又重新运行一个完整的建设周期, 其原因何在?
原标题:What is the reason that the spring-boot-maven-plugin reruns a full build cycle again when I trigger the build-image goal?
We ve noticed that when we run the build-image goal as part of our maven lifecycle, the entire lifecycle runs twice (compile, test-compile, report, etc). This is not an issue for most plugins, since they detect this behavior and will simply not run again. However, we have some reporting plugins that will generate incorrect reports due to this behavior. Is there a way to disable it? And why does it happen? Edit: https://github.com/Luckl/spring-boot-maven-test with a very basic example.
最佳回答
The reason why most of the lifecycle is being run twice, is because the "build-image" goal in Spring Boot Maven plugin requires the package phase to be run beforehand. In the logs you can see that Maven executes this phase in a fork: [INFO] >>> spring-boot-maven-plugin:2.3.0.RELEASE:build-image (default-cli) > package @ spring-boot-maven-test >>> As far as I know Maven does not have a system in place to skip running that phase again when it already has run in that same build (when this annotation is used). What you could do to circumvent this is to not bind the build-image goal in the regular Maven lifecycle, but rather call it directly: mvn spring-boot:build-image. The result will be that the plugin triggers the package phase, and afterwards builds the docker image. If you need to add reporting plugins to your build you could add that to the package lifecycle (which then also will be built as prerequisite to build-image), or you could call a separate mvn command afterwards (where you could skip/include certain plugins with profiles). Update: A PR has been submitted to fix this in Maven, follow the links to GitHub from here: https://issues.apache.org/jira/browse/MNG-6566
问题回答

暂无回答




相关问题
JavaFX with Maven [closed]

I recently started a JavaFX project, and I d like to use Maven as my compiler/deployment tool. Is there a good tutorial or plugin to integrate JavaFX and Maven?

How to upload jar to respository?

I have jar files that cannot be found on Maven Central repository. I would like to add the jar so I can just include extra tag in my pom.xml file and other developer can use the jar. What are the ...

Debug Maven project in Eclipse with third party sources

I am currently developing a maven project in eclipse. The m2eclipse plugin works beautifully. It even works out of the box with debugging. But when I am debugging open source third party libarries. ...

Could Free Pascal benefit of something like Apache Maven?

Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it ...

Run a single test method with maven

I know you can run all the tests in a certain class using: mvn test -Dtest=classname But I want to run an individual method and -Dtest=classname.methodname doesn t seem to work.

Uploading a directory using sftp with Maven

How can I upload a directory - Eclipse update site - using sftp with public key authentication in Maven? For background information: I m using tycho to build an Eclipse plugin and want to get the ...

What are solid NMaven or build servers for .NET alternatives?

Maven had a long history and is well supported in the Java world. NMaven has received a less successful start and has never become as popular in the C#/.NET world as its larger cousin was in the Java ...

热门标签