Permalink
Browse files

POM cleanup, use simpler version scheme like Modules does

  • Loading branch information...
1 parent 22bd8e8 commit 3666e6255caca362409889b23add2415e317e8c9 @dmlloyd dmlloyd committed Nov 14, 2012
Showing with 66 additions and 70 deletions.
  1. +20 −65 pom.xml
  2. +46 −5 src/main/java/org/jboss/msc/Version.java
View
85 pom.xml
@@ -38,39 +38,32 @@
<name>JBoss Modular Service Container</name>
<properties>
- <byteman-version>1.5.1</byteman-version>
+ <version.apiviz>1.3.1.GA</version.apiviz>
+ <version.byteman>1.5.1</version.byteman>
<version.jboss-logmanager>1.2.2.GA</version.jboss-logmanager>
+ <version.jboss-logging>3.1.1.GA</version.jboss-logging>
+ <version.jboss-logging-processor>1.0.3.Final</version.jboss-logging-processor>
+ <version.jboss-modules>1.1.2.GA</version.jboss-modules>
+ <version.junit>4.7</version.junit>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
- <version>1.0.1.Final</version>
+ <version>${version.jboss-logging-processor}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
- <version>1.1.1.GA</version>
+ <version>${version.jboss-modules}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>3.1.0.Final</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
- <version>3.1.0.GA</version>
+ <version>${version.jboss-logging}</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -80,39 +73,27 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.jboss.threads</groupId>
- <artifactId>jboss-threads</artifactId>
- <version>2.0.0.GA</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>1.0-PFD-1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.7</version>
+ <version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman</artifactId>
- <version>${byteman-version}</version>
+ <version>${version.byteman}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-bmunit</artifactId>
- <version>${byteman-version}</version>
+ <version>${version.byteman}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-install</artifactId>
- <version>${byteman-version}</version>
+ <version>${version.byteman}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -126,32 +107,6 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-injection-plugin</artifactId>
- <version>1.0.2</version>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>bytecode</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <bytecodeInjections>
- <bytecodeInjection>
- <expression>${project.version}</expression>
- <targetMembers>
- <methodBodyReturn>
- <className>org.jboss.msc.Version</className>
- <methodName>getVersionString</methodName>
- </methodBodyReturn>
- </targetMembers>
- </bytecodeInjection>
- </bytecodeInjections>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
@@ -208,7 +163,8 @@
</property>
</systemProperties>
<!-- add this to agent parameter list to enable debug ,prop:org.jboss.byteman.debug=true -->
- <argLine>-Xbootclasspath/a:${settings.localRepository}/org/jboss/logmanager/${version.jboss-logmanager}/jboss-logmanager-${version.jboss-logmanager}.jar -javaagent:${settings.localRepository}/org/jboss/byteman/byteman/${byteman-version}/byteman-${byteman-version}.jar=boot:${settings.localRepository}/org/jboss/byteman/byteman/${byteman-version}/byteman-${byteman-version}.jar,script:${project.build.testOutputDirectory}/org/jboss/msc/racecondition/RejectedExecutionTestCase.btm</argLine>
+ <argLine>-Xbootclasspath/a:${settings.localRepository}/org/jboss/logmanager/${version.jboss-logmanager}/jboss-logmanager-${version.jboss-logmanager}.jar
+ -javaagent:${settings.localRepository}/org/jboss/byteman/byteman/${version.byteman}/byteman-${version.byteman}.jar=boot:${settings.localRepository}/org/jboss/byteman/byteman/${version.byteman}/byteman-${version.byteman}.jar,script:${project.build.testOutputDirectory}/org/jboss/msc/racecondition/RejectedExecutionTestCase.btm</argLine>
<includes>
<include>org/jboss/msc/racecondition/RejectedExecutionTestSuite.java</include>
</includes>
@@ -237,7 +193,6 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.6.1</version>
<configuration>
<docfilessubdirs>true</docfilessubdirs>
<detectJavaApiLink>false</detectJavaApiLink>
@@ -246,12 +201,12 @@
<docletArtifact>
<groupId>org.jboss.apiviz</groupId>
<artifactId>apiviz</artifactId>
- <version>1.3.1.GA</version>
+ <version>${version.apiviz}</version>
</docletArtifact>
- <doctitle><![CDATA[JBoss Modular Service Kernel API ]]>${project.version}</doctitle>
- <header><![CDATA[JBoss Modular Service Kernel API ]]>${project.version}</header>
- <footer><![CDATA[JBoss Modular Service Kernel API ]]>${project.version}</footer>
- <bottom><![CDATA[<i>Copyright &#169; 2011 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
+ <doctitle><![CDATA[JBoss Modular Service Container ]]>${project.version}</doctitle>
+ <header><![CDATA[JBoss Modular Service Container ]]>${project.version}</header>
+ <footer><![CDATA[JBoss Modular Service Container ]]>${project.version}</footer>
+ <bottom><![CDATA[<i>Copyright &#169; 2012 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
<links>
<link>http://java.sun.com/javase/6/docs/api/</link>
</links>
@@ -22,6 +22,13 @@
package org.jboss.msc;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
/**
* The current version of this module.
*
@@ -30,18 +37,52 @@
public final class Version {
private Version() {}
+ private static final String JAR_NAME;
+ private static final String VERSION_STRING;
+
+ static {
+ final Enumeration<URL> resources;
+ String jarName = "(unknown)";
+ String versionString = "(unknown)";
+ try {
+ final ClassLoader classLoader = Version.class.getClassLoader();
+ resources = classLoader == null ? ClassLoader.getSystemResources("META-INF/MANIFEST.MF") : classLoader.getResources("META-INF/MANIFEST.MF");
+ while (resources.hasMoreElements()) {
+ final URL url = resources.nextElement();
+ final InputStream stream = url.openStream();
+ if (stream != null) try {
+ final Manifest manifest = new Manifest(stream);
+ final Attributes mainAttributes = manifest.getMainAttributes();
+ if (mainAttributes != null && "JBoss Modular Service Container".equals(mainAttributes.getValue("Specification-Title"))) {
+ jarName = mainAttributes.getValue("Jar-Name");
+ versionString = mainAttributes.getValue("Jar-Version");
+ }
+ } finally {
+ try { stream.close(); } catch (Throwable ignored) {}
+ }
+ }
+ } catch (IOException ignored) {
+ }
+ JAR_NAME = jarName;
+ VERSION_STRING = versionString;
+ }
+
/**
- * The current version.
+ * Get the name of the JBoss Modules JAR.
+ *
+ * @return the name
*/
- public static final String VERSION = getVersionString();
+ public static String getJarName() {
+ return JAR_NAME;
+ }
/**
- * Get the version string.
+ * Get the version string of JBoss Modules.
*
* @return the version string
*/
public static String getVersionString() {
- return "TRUNK SNAPSHOT";
+ return VERSION_STRING;
}
/**
@@ -50,6 +91,6 @@ public static String getVersionString() {
* @param args ignored
*/
public static void main(String[] args) {
- System.out.printf("JBoss Modular Service Container version %s\n", VERSION);
+ System.out.printf("JBoss Modular Service Container version %s\n", VERSION_STRING);
}
}

0 comments on commit 3666e62

Please sign in to comment.