# HG changeset patch # Parent 153d5a9478f684b45558e528380a81fd5f34ca46 # User Jesse Glick # Date 1374766645 14400 #208411: hint to explicit set !preferSources for a project without using Shade plugin. diff --git a/maven/src/org/netbeans/modules/maven/api/Constants.java b/maven/src/org/netbeans/modules/maven/api/Constants.java --- a/maven/src/org/netbeans/modules/maven/api/Constants.java +++ b/maven/src/org/netbeans/modules/maven/api/Constants.java @@ -43,6 +43,7 @@ import java.util.Arrays; import java.util.List; +import org.netbeans.modules.maven.spi.queries.ForeignClassBundler; /** * Various constants used across the integration, Maven property names with a meaning in the IDE, @@ -92,6 +93,15 @@ public static final String HINT_DISPLAY_NAME = "netbeans.hint.displayName"; /** + * Maven property instructing NetBeans whether to prefer sources to binaries when scanning classpaths. + * The default is generally true (barring a {@link ForeignClassBundler} claiming otherwise), + * so this property can be set to {@code false} to indicate that a project uses an idiosyncratic means of producing its primary JAR artifact + * which then does not correspond completely (or at all) to {@code src/main/java/}. + * @since 2.84 + */ + String HINT_PREFER_SOURCES = "netbeans.hint.prefer.sources"; + + /** * apache maven default groupid for maven plugins. */ public static final String GROUP_APACHE_PLUGINS = "org.apache.maven.plugins"; //NOI18N diff --git a/maven/src/org/netbeans/modules/maven/queries/ShadePluginDetector.java b/maven/src/org/netbeans/modules/maven/queries/ShadePluginDetector.java --- a/maven/src/org/netbeans/modules/maven/queries/ShadePluginDetector.java +++ b/maven/src/org/netbeans/modules/maven/queries/ShadePluginDetector.java @@ -48,9 +48,11 @@ import org.netbeans.spi.project.ProjectServiceProvider; import org.openide.util.NbBundle; import static org.netbeans.modules.maven.queries.Bundle.*; +import org.netbeans.spi.project.AuxiliaryProperties; /** * Indicates that a shaded JAR should be consulted in preference to sources. + * Also checks {@link Constants#HINT_PREFER_SOURCES}. */ @ProjectServiceProvider(service=ForeignClassBundler.class, projectType="org-netbeans-modules-maven") @NbBundle.Messages({ @@ -78,6 +80,10 @@ if (nbmp == null) { return true; } + String hint = project.getLookup().lookup(AuxiliaryProperties.class).get(Constants.HINT_PREFER_SOURCES, true); + if (hint != null) { + return Boolean.parseBoolean(hint); + } if (PluginPropertyUtils.getPluginVersion(nbmp.getMavenProject(), Constants.GROUP_APACHE_PLUGINS, "maven-shade-plugin") == null) { return true; }