From ba052272db890fc38c23bbf68d45265cf24ab4b1 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Fri, 3 Jul 2020 01:03:36 +0200 Subject: Fail the build if the 'component' artifact is embedded. + Improve the error message. --- .../yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'bundle-plugin/src') diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java index 864c8d6fe9c..d5aaa5888b2 100644 --- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java +++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java @@ -181,16 +181,15 @@ public class GenerateOsgiManifestMojo extends AbstractGenerateOsgiManifestMojo { artifact.getId(), artifact.getType()))); } - // TODO: fail the build by throwing a MojoExecutionException private void warnIfInternalContainerArtifactsAreIncluded(Collection includedArtifacts) throws MojoExecutionException { /* In most cases it's sufficient to test for 'component', as it's the lowest level container artifact, * Embedding container artifacts will cause class loading issues at runtime, because the classes will - * not be equal to those seen by the framework (e.g. AbstractComponent). - */ + * not be equal to those seen by the framework (e.g. AbstractComponent). */ if (includedArtifacts.stream().anyMatch(this::isJdiscComponentArtifact)) { - getLog().warn("This project includes the 'com.yahoo.vespa:component' artifact in compile scope." + - " It must be set to scope 'provided' to avoid resource leaks in your application at runtime." + - " The build will fail on a future Vespa version unless this is fixed."); + throw new MojoExecutionException( + "This project includes the 'com.yahoo.vespa:component' artifact in compile scope." + + " It must have scope 'provided' to avoid resource leaks in your application at runtime." + + " Please use 'mvn dependency:tree' to find the root cause."); } } -- cgit v1.2.3