From 651346f416a9369116b34837dcf90ad53d94cd8c Mon Sep 17 00:00:00 2001 From: dcendents Date: Tue, 26 Mar 2013 16:42:12 +0000 Subject: [PATCH] Dealing with problems when a project depend on another for the normal jar and also the test-jar. --- build.properties | 42 +- build.xml | 422 +++++++++++++++--- plugin.properties | 26 +- plugin.xml | 2 +- .../eclipse/tomcat/TomcatBootstrap.java | 16 +- 5 files changed, 427 insertions(+), 81 deletions(-) diff --git a/build.properties b/build.properties index d4143a8..d5034de 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,43 @@ source.tomcat.jar = src/ bin.includes = plugin.xml,\ - *.jar + *.jar,\ + DevLoader.zip,\ + icons/,\ + img/,\ + license.txt,\ + plugin.properties,\ + plugin_bg.properties,\ + plugin_de.properties,\ + plugin_fr.properties,\ + plugin_it.properties,\ + plugin_ja.properties,\ + plugin_ptbr.properties,\ + readme.html,\ + readmeDevLoader.html,\ + releaseNotesV33.txt +src.includes = .classpath,\ + .project,\ + .settings/,\ + DevFileDirContextTomcat7/,\ + DevFileDirContextTomcat7-7.0.23.0.jar,\ + DevLoader/,\ + DevLoader.zip,\ + DevloaderTomcat7/,\ + DevloaderTomcat7.jar,\ + build.properties,\ + build.xml,\ + icons/,\ + img/,\ + license.txt,\ + plugin.properties,\ + plugin.xml,\ + plugin_bg.properties,\ + plugin_de.properties,\ + plugin_fr.properties,\ + plugin_it.properties,\ + plugin_ja.properties,\ + plugin_ptbr.properties,\ + readme.html,\ + readmeDevLoader.html,\ + releaseNotesV33.txt,\ + src/ diff --git a/build.xml b/build.xml index a11babf..95130b4 100644 --- a/build.xml +++ b/build.xml @@ -1,113 +1,422 @@ - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - + + + + + + - --> - - - + + + + + + + - + - - - + + + + + + + + + + + + + + - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - + - - + + + - - + + + - + - - - + @@ -115,13 +424,16 @@ - + + + - + - - + + + diff --git a/plugin.properties b/plugin.properties index 177817f..00e25ed 100644 --- a/plugin.properties +++ b/plugin.properties @@ -1,23 +1,3 @@ -# @author Bruno Leroux -pluginName = Sysdeo Tomcat Launcher Plugin - -menu.label = &Tomcat -menu.start.label = &Start Tomcat -menu.stop.label = S&top Tomcat -menu.restart.label = &Restart Tomcat - -wizard.newTomcatProject.label = Tomcat Project -wizard.newJavaProject.description = Create a Java project with a WAR structure - -menu.nature.label = Tomcat project -menu.nature.createWork.label = Create JSP work directory -menu.nature.updateContext.label = Update context definition -menu.nature.removeContext.label = Remove context definition -menu.nature.addTomcatJar.label = Add Tomcat libraries to project build path -menu.nature.exportToWar.label = Export to the WAR file sets in project properties -menu.nature.restartContext.label = Reload this context - -pref.menu.jvmSettings.label = JVM Settings -pref.menu.sourcepath.label = Source Path -pref.menu.managerapp.label = Tomcat Manager App -pref.menu.advanced.label = Advanced +##Source Bundle Localization +#Fri Jan 25 14:03:31 GMT 2013 +pluginName=com.sysdeo.eclipse.tomcat.source diff --git a/plugin.xml b/plugin.xml index 3c3f253..2687b6d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ diff --git a/src/com/sysdeo/eclipse/tomcat/TomcatBootstrap.java b/src/com/sysdeo/eclipse/tomcat/TomcatBootstrap.java index 11ae4e7..86bcf0d 100644 --- a/src/com/sysdeo/eclipse/tomcat/TomcatBootstrap.java +++ b/src/com/sysdeo/eclipse/tomcat/TomcatBootstrap.java @@ -294,11 +294,25 @@ private void getClassPathEntries(IClasspathEntry[] entries, IJavaProject prj, Ar for (int j = 0; j < tmpEntry.length; j++) { // Check maven scope if defined boolean isRuntime = true; + boolean isSnapshot = false; + boolean isTestJar = false; for (IClasspathAttribute att : tmpEntry[j].getExtraAttributes()) { if ("maven.scope".equals(att.getName())) { isRuntime = "compile".equals(att.getValue()) || "runtime".equals(att.getValue()); - break; } + else if ("maven.version".equals(att.getName())) { + isSnapshot = att.getValue() != null && att.getValue().contains("SNAPSHOT"); + } + else if ("maven.classifier".equals(att.getName())) { + isTestJar = "tests".equals(att.getValue()); + } + } + + // If a project depends on both the jar/compile and test-jar/test dependency of the same eclipse project, + // the maven container only contains the definition for the latter (ie: test dependency) + // So we need to force the include of the project + if( !isRuntime && isSnapshot && isTestJar && tmpEntry[j].getEntryKind() == IClasspathEntry.CPE_PROJECT ) { + isRuntime = true;; } if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {