[217138]
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java index 49e5a1e..04ef9ab 100644 --- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java +++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java
@@ -217,6 +217,27 @@ } catch (JavaModelException e) { Logger.getLogger().logError(e); } + //the default behavior is to always export these dependencies + boolean exportEntries = true; + boolean useJDTToControlExport = J2EEComponentClasspathContainerUtils.getDefaultUseEARLibrariesJDTExport(); + if(useJDTToControlExport){ + //if the default is not enabled, then check whether the container is being exported + try{ + IClasspathEntry [] rawEntries = javaProject.getRawClasspath(); + for(int i=0;i<rawEntries.length; i++){ + IClasspathEntry entry = rawEntries[i]; + if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER){ + if(entry.getPath().equals(CONTAINER_PATH)){ + exportEntries = entry.isExported(); + break; + } + } + } + } catch (JavaModelException e) { + Logger.getLogger().logError(e); + } + } + for (int i = 0; i < refsList.size(); i++) { ref = (IVirtualReference)refsList.get(i); comp = ref.getReferencedComponent(); @@ -248,13 +269,13 @@ attrs = dec.getExtraAttributes(); } - entriesList.add(JavaCore.newLibraryEntry( lastUpdate.paths[i], srcpath, srcrootpath, access, attrs, true )); + entriesList.add(JavaCore.newLibraryEntry( lastUpdate.paths[i], srcpath, srcrootpath, access, attrs, exportEntries )); } } else { IProject project = comp.getProject(); lastUpdate.paths[i] = project.getFullPath(); if (!isAlreadyOnClasspath(existingEntries, lastUpdate.paths[i])) { - entriesList.add(JavaCore.newProjectEntry(lastUpdate.paths[i], true)); + entriesList.add(JavaCore.newProjectEntry(lastUpdate.paths[i], exportEntries)); } } }
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainerUtils.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainerUtils.java index b714109..762878c 100644 --- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainerUtils.java +++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainerUtils.java
@@ -16,6 +16,10 @@ return J2EEPlugin.getDefault().getJ2EEPreferences().getUseEARLibraries(); } + public static boolean getDefaultUseEARLibrariesJDTExport() { + return J2EEPlugin.getDefault().getJ2EEPreferences().getUseEARLibrariesJDTExport(); + } + public static boolean getDefaultUseWebAppLibraries() { return J2EEPlugin.getDefault().getJ2EEPreferences().getUseWebLibaries(); }
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java index d815724..b82710b 100644 --- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java +++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPreferences.java
@@ -48,6 +48,7 @@ final static String USE_EAR_LIBRARIES = "org.eclipse.jst.j2ee.preferences.useEARLibraries";//$NON-NLS-1$ final static String USE_WEB_APP_LIBRARIES = "org.eclipse.jst.j2ee.preferences.useWebAppLibraries";//$NON-NLS-1$ + final static String USE_EAR_LIBRARIES_JDT_EXPORT = "org.eclipse.jst.j2ee.preferences.useEARLibrariesJDTExport";//$NON-NLS-1$ /** * @deprecated, @@ -142,6 +143,7 @@ final static boolean CREATE_EJB_CLIENT_JAR = false; final static boolean EJB_CLIENT_JAR_CP_COMPATIBILITY = true; final static boolean INCREMENTAL_DEPLOYMENT_SUPPORT = true; + final static boolean USE_EAR_LIBRARIES_JDT_EXPORT = false; } private Plugin owner = null; @@ -184,6 +186,7 @@ getPreferences().setDefault(Keys.USE_EAR_LIBRARIES, true); getPreferences().setDefault(Keys.USE_WEB_APP_LIBRARIES, true); + getPreferences().setDefault(Keys.USE_EAR_LIBRARIES_JDT_EXPORT, Defaults.USE_EAR_LIBRARIES_JDT_EXPORT); } @@ -205,6 +208,15 @@ firePreferenceChanged(); } + public boolean getUseEARLibrariesJDTExport() { + return getPreferences().getBoolean(Keys.USE_EAR_LIBRARIES_JDT_EXPORT); + } + + public void setUseEARLibrariesJDTExport(boolean value) { + getPreferences().setValue(Keys.USE_EAR_LIBRARIES_JDT_EXPORT, value); + firePreferenceChanged(); + } + public boolean getUseWebLibaries() { return getPreferences().getBoolean(Keys.USE_WEB_APP_LIBRARIES); }