Author: fbricon
Date: 2012-02-24 10:12:29 -0500 (Fri, 24 Feb 2012)
New Revision: 39117
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
Removed:
trunk/examples/plugins/org.jboss.tools.project.examples/template/
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/pom.xml
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
Log:
JBIDE-10401 : improve maven filtering for discovery url externalization
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/pom.xml
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/pom.xml 2012-02-24 15:08:03
UTC (rev 39116)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/pom.xml 2012-02-24 15:12:29
UTC (rev 39117)
@@ -9,14 +9,15 @@
</parent>
<groupId>org.jboss.tools.examples.plugins</groupId>
<artifactId>org.jboss.tools.project.examples</artifactId>
-
- <properties>
+
+ <properties>
<!-- TODO: for GA, change this from /development/indigo/ to /stable/indigo/ -->
<
jboss.discovery.directory.url>http://download.jboss.org/jbosstools/upd...
</properties>
<profiles>
- <!-- _stable_branch jobs could use this profile but the above default (last stable
milestone) is probably better -->
+ <!-- _stable_branch jobs could use this profile but the above default (last
+ stable milestone) is probably better -->
<profile>
<id>3.3.indigo</id>
<activation>
@@ -40,59 +41,32 @@
</profiles>
<packaging>eclipse-plugin</packaging>
<build>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/discovery.properties</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<plugins>
- <!-- This will copy from the source folder to the template folder. Use only if no
filtering/replacement has already been done in source folder
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
- <id>copy-resources</id>
- <phase>validate</phase>
+ <id>resource-filtering</id>
+ <!-- Need to execute resource filtering AFTER tycho-compiler-plugin
+ is executed -->
+ <phase>process-classes</phase>
<goals>
- <goal>copy-resources</goal>
+ <goal>resources</goal>
</goals>
- <configuration>
- <outputDirectory>${basedir}/template/</outputDirectory>
- <resources>
- <resource>
- <directory>src/org/jboss/tools/project/examples/configurators/</directory>
- <includes>
- <include>**/DefaultJBossCentralConfigurator.java</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
</execution>
</executions>
- </plugin> -->
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.5</version>
- <executions>
- <execution>
- <id>copy-resources</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/src/org/jboss/tools/project/examples/configurators/</outputDirectory>
- <resources>
- <resource>
- <directory>template/</directory>
- <includes>
- <include>**/DefaultJBossCentralConfigurator.java</include>
- </includes>
- <filtering>true</filtering>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
-
+
</project>
\ No newline at end of file
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-02-24
15:08:03 UTC (rev 39116)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-02-24
15:12:29 UTC (rev 39117)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.ResourceBundle;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
@@ -44,7 +45,18 @@
private static final String JBOSS_DIRECTORY_URL_DEFAULT =
"http://download.jboss.org/jbosstools/updates/development/indigo/jbosstools-directory.xml";
//$NON-NLS-1$
// see pom.xml for actual value -- this is passed it at build-time via Maven
- private static final String JBOSS_DIRECTORY_URL =
"http://download.jboss.org/jbosstools/updates/development/indigo/jbosstools-directory.xml";
//$NON-NLS-1$
+ private static final String JBOSS_DIRECTORY_URL;
+
+ static {
+ ResourceBundle rb =
ResourceBundle.getBundle("org.jboss.tools.project.examples.configurators.discovery");
//$NON-NLS-1$
+ String url = rb.getString("discovery.url").trim(); //$NON-NLS-1$
+ if ("".equals(url) ||
"${jboss.discovery.directory.url}".equals(url)){ //$NON-NLS-1$//$NON-NLS-2$
+ //was not filtered, fallback to default value
+ JBOSS_DIRECTORY_URL = JBOSS_DIRECTORY_URL_DEFAULT;
+ } else {
+ JBOSS_DIRECTORY_URL = url;
+ }
+ }
private static final String TWITTER_LINK ="http://twitter.com/#!/jbosstools";
//$NON-NLS-1$
@@ -66,8 +78,8 @@
// use commandline override -Djboss.discovery.directory.url
String directory =
System.getProperty(ProjectExamplesActivator.JBOSS_DISCOVERY_DIRECTORY, null);
if (directory == null) {
- // else use Maven-generated value; fall back to default
- return JBOSS_DIRECTORY_URL.equals("${" +
"jboss.discovery.directory.url" + "}") ? JBOSS_DIRECTORY_URL_DEFAULT :
JBOSS_DIRECTORY_URL; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // else use Maven-generated value (or fall back to default)
+ return JBOSS_DIRECTORY_URL;
}
return directory;
}
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties 2012-02-24
15:12:29 UTC (rev 39117)
@@ -0,0 +1 @@
+discovery.url=${jboss.discovery.directory.url}
\ No newline at end of file