Skip to content

Commit

Permalink
Hacking
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Nov 21, 2022
1 parent c93e248 commit 5e539c7
Show file tree
Hide file tree
Showing 28 changed files with 102 additions and 33 deletions.
Expand Up @@ -209,6 +209,7 @@ You can override this behaviour as shown in the <<build-image.examples.builder-c
For more details, see also <<build-image.examples,examples>>.

include::goals/build-image.adoc[leveloffset=+1]
include::goals/build-image-no-fork.adoc[leveloffset=+1]



Expand Down
Expand Up @@ -12,7 +12,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -41,7 +41,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -35,7 +35,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -25,7 +25,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -20,7 +20,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<finalName>final-name</finalName>
Expand Down
Expand Up @@ -27,7 +27,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -20,7 +20,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -25,7 +25,7 @@
</execution>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
Expand Down
Expand Up @@ -19,7 +19,7 @@
<executions>
<execution>
<goals>
<goal>build-image</goal>
<goal>build-image-no-fork</goal>
</goals>
<configuration>
<image>
Expand Down
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.boot.maven;

import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
* {@link BuildImageMojo implementation} that forks the lifecycle to make sure that
* {@code package} ran. This goal is suitable for command-line invocation. If you need to
* configure a mojo {@code execution} in your build, use {@link BuildImageNoForkMojo}
* instead.
*
* @author Stephane Nicoll
* @since 3.0.0
*/
@Mojo(name = "build-image", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Execute(phase = LifecyclePhase.PACKAGE)
public class BuildImageForkMojo extends BuildImageMojo {

}
Expand Up @@ -32,11 +32,7 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;

import org.springframework.boot.buildpack.platform.build.AbstractBuildLog;
import org.springframework.boot.buildpack.platform.build.BuildLog;
Expand All @@ -62,11 +58,7 @@
* @author Jeroen Meijer
* @since 2.3.0
*/
@Mojo(name = "build-image", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Execute(phase = LifecyclePhase.PACKAGE)
public class BuildImageMojo extends AbstractPackagerMojo {
public abstract class BuildImageMojo extends AbstractPackagerMojo {

static {
System.setProperty("org.slf4j.simpleLogger.log.org.apache.http.wire", "ERROR");
Expand Down
@@ -0,0 +1,37 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.boot.maven;

import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
* {@link BuildImageMojo implementation} that does not fork the lifecycle to make sure
* that {@code package} ran. This goal should be used when configuring a mojo
* {@code execution} in your build. To invoke the goal on the command-line, use
* {@link BuildImageForkMojo} instead.
*
* @author Stephane Nicoll
* @since 3.0.0
*/
@Mojo(name = "build-image-no-fork", defaultPhase = LifecyclePhase.PACKAGE, requiresProject = true, threadSafe = true,
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class BuildImageNoForkMojo extends BuildImageMojo {

}

0 comments on commit 5e539c7

Please sign in to comment.