-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce UberJarMergedResourceBuildItem
and UberJarIgnoredResourceBuildItem
#17077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at it in detail but it would be better to name it UberJarMergedResourceBuildItem
.
The way it is right now, it looks like an event that is triggered once resources are merged.
2631d23
to
b5cb14f
Compare
b5cb14f
to
2729dc4
Compare
UberJarMergedResourceBuildItem
and UberJarIgnoredResourceBuildItem
2729dc4
to
ae4fd89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have some kind of test for this
Definitely! Can you point me to a test that uses Build Items for reference? |
See Line 34 in 2cbd177
|
@geoand hm, that doesn't seem to work for building Uber JARs 😞 Should I use |
More specifically, this test doesn't work: package io.quarkus.deployment.pkg.builditem;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
import java.util.function.Consumer;
import io.quarkus.bootstrap.model.AppArtifact;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.test.QuarkusUnitTest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import static org.assertj.core.api.Assertions.assertThat;
class UberJarMergedResourceBuildItemTest {
@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class))
.withConfigurationResource("application-uber-jar.properties")
.setForcedDependencies(
Collections.singletonList(
new AppArtifact("org.apache.cxf", "cxf-rt-transports-http", "3.4.3")
))
.addBuildChainCustomizer(buildCustomizer());
@Test
public void testResourceWasMerged() throws IOException {
List<URL> resources = Collections.list(getClass().getClassLoader().getResources("META-INF/cxf/bus-extensions.txt"));
assertThat(resources).hasSize(1);
}
static Consumer<BuildChainBuilder> buildCustomizer() {
return (buildChainBuilder ->
buildChainBuilder
.addBuildStep(context ->
context.produce(new UberJarMergedResourceBuildItem("META-INF/cxf/bus-extensions.txt")))
.produces(UberJarMergedResourceBuildItem.class)
.build()
);
}
} |
Ah darn, you are right. We would likely need to add the same capability to the prod mode test. |
Hm, |
ae4fd89
to
12f58ac
Compare
It would be nice to backport this feature so our Quarkiverse maintainers could use it in the 1.13.x versions |
...t/src/test/java/io/quarkus/deployment/pkg/builditem/UberJarIgnoredResourceBuildItemTest.java
Show resolved
Hide resolved
There is an import issue. Next 1.13 (and probably last) will be released on Wednesday morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The imports need a fix and the tests could be improved a bit. If this is done before tomorrow evening, I can backport it. Thanks!
...nt/src/test/java/io/quarkus/deployment/pkg/builditem/UberJarMergedResourceBuildItemTest.java
Show resolved
Hide resolved
...nt/src/test/java/io/quarkus/deployment/pkg/builditem/UberJarMergedResourceBuildItemTest.java
Outdated
Show resolved
Hide resolved
12f58ac
to
cc06b7b
Compare
cc06b7b
to
cc2d7a9
Compare
This workflow status is outdated as a new workflow run has been triggered. |
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building cc2d7a9
Full information is available in the Build summary check run. Test Failures⚙️ Gradle Tests - JDK 11 Linux #📦 integration-tests/gradle✖ ✖ ✖ ✖ ✖ ⚙️ Gradle Tests - JDK 11 Windows #📦 integration-tests/gradle✖ ✖ ✖ ✖ ✖ ⚙️ JVM Tests - JDK 11 Windows #📦 integration-tests/resteasy-reactive-rest-client✖ |
cc2d7a9
to
3f07985
Compare
Fixes #5677