Index: src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (revision 745666)
+++ src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (working copy)
@@ -291,6 +291,7 @@
final String unauthenticatedPrincipal =
jboss.getChild( JbossConfiguration.UNAUHTHENTICTED_PRINCIPAL ).getValue();
final String loaderRepository = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY ).getValue();
+ final String loaderRepositoryClass = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY_CLASS ).getValue();
final String jmxName = jboss.getChild( JbossConfiguration.JMX_NAME ).getValue();
final String moduleOrder = jboss.getChild( JbossConfiguration.MODULE_ORDER ).getValue();
@@ -308,8 +309,13 @@
}
}
+ final String libraryDirectory = jboss.getChild( JbossConfiguration.LIBRARY_DIRECTORY ).getValue();
+ final String loaderRepositoryConfig = jboss.getChild( JbossConfiguration.LOADER_REPOSITORY_CONFIG ).getValue();
+ final String configParserClass = jboss.getChild( JbossConfiguration.CONFIG_PARSER_CLASS ).getValue();
jbossConfiguration = new JbossConfiguration( version, securityDomain, unauthenticatedPrincipal, jmxName,
- loaderRepository, moduleOrder, dataSources );
+ loaderRepository, moduleOrder, dataSources,
+ libraryDirectory, loaderRepositoryConfig,
+ loaderRepositoryClass, configParserClass );
}
catch ( PlexusConfigurationException e )
{
Index: src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java
===================================================================
--- src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java (revision 745666)
+++ src/main/java/org/apache/maven/plugin/ear/JbossAppXmlWriter.java (working copy)
@@ -46,6 +46,9 @@
public static final String DOCTYPE_4_2 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD J2EE Application 1.4//EN\"\n" +
"\t\"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd\"";
+ public static final String DOCTYPE_5 = "jboss-app PUBLIC\n" + "\t\"-//JBoss//DTD Java EE Application 5.0//EN\"\n" +
+ "\t\"http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd\"";
+
private static final String JBOSS_APP_ELEMENT = "jboss-app";
JbossAppXmlWriter( String encoding )
@@ -67,16 +70,32 @@
{
writer = initializeXmlWriter( w, DOCTYPE_4 );
}
- else
+ else if ( jbossConfiguration.isJbossFourDotTwo() )
{
writer = initializeXmlWriter( w, DOCTYPE_4_2 );
}
+ else
+ {
+ writer = initializeXmlWriter( w, DOCTYPE_5 );
+ }
writer.startElement( JBOSS_APP_ELEMENT );
+ // If JBoss 4.2 or 5.0, write the JBoss 4.2 and JBoss 5.0-compatible stuff
+ if ( jbossConfiguration.isJbossFourDotTwo() || jbossConfiguration.isJbossFive() )
+ {
+ // library-directory
+ if ( jbossConfiguration.getLibraryDirectory() != null )
+ {
+ writer.startElement( JbossConfiguration.LIBRARY_DIRECTORY );
+ writer.writeText ( jbossConfiguration.getLibraryDirectory() );
+ writer.endElement();
+ }
+ }
+
// If JBoss 4.2, write the jboss4.2 specific stuff
if ( jbossConfiguration.isJbossFourDotTwo() )
{
- // module-order
+ // module-order (only available in 4.2 and 4.3)
if ( jbossConfiguration.getModuleOrder() != null )
{
writer.startElement( JbossConfiguration.MODULE_ORDER );
@@ -103,10 +122,38 @@
}
// classloader repository
- if ( jbossConfiguration.getLoaderRepository() != null )
+ if ( jbossConfiguration.getLoaderRepository() != null || jbossConfiguration.getLoaderRepositoryConfig() != null)
{
writer.startElement( JbossConfiguration.LOADER_REPOSITORY );
- writer.writeText( jbossConfiguration.getLoaderRepository() );
+
+ // classloader repository class
+ if ( jbossConfiguration.getLoaderRepositoryClass() != null)
+ {
+ writer.addAttribute( JbossConfiguration.LOADER_REPOSITORY_CLASS,
+ jbossConfiguration.getLoaderRepositoryClass() );
+ }
+
+ // we don't need to write any text if only the loader repo configuration is changed
+ if ( jbossConfiguration.getLoaderRepository() != null )
+ {
+ writer.writeText( jbossConfiguration.getLoaderRepository() );
+ }
+
+ // classloader configuration
+ if ( jbossConfiguration.getLoaderRepositoryConfig() != null )
+ {
+ writer.startElement( JbossConfiguration.LOADER_REPOSITORY_CONFIG );
+
+ // classloader configuration parser
+ if ( jbossConfiguration.getConfigParserClass() != null)
+ {
+ writer.addAttribute( JbossConfiguration.CONFIG_PARSER_CLASS,
+ jbossConfiguration.getConfigParserClass() );
+ }
+ writer.writeText( jbossConfiguration.getLoaderRepositoryConfig() );
+ writer.endElement();
+ }
+
writer.endElement();
}
Index: src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java
===================================================================
--- src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java (revision 745666)
+++ src/main/java/org/apache/maven/plugin/ear/JbossConfiguration.java (working copy)
@@ -37,6 +37,8 @@
static final String VERSION_4_2 = "4.2";
+ static final String VERSION_5 = "5";
+
static final String VERSION = "version";
static final String SECURITY_DOMAIN = "security-domain";
@@ -53,6 +55,14 @@
static final String DATASOURCE = "data-source";
+ static final String LIBRARY_DIRECTORY = "library-directory";
+
+ static final String LOADER_REPOSITORY_CONFIG = "loader-repository-config";
+
+ static final String LOADER_REPOSITORY_CLASS = "loaderRepositoryClass";
+
+ static final String CONFIG_PARSER_CLASS = "configParserClass";
+
private final String version;
private boolean jbossThreeDotTwo;
@@ -61,6 +71,8 @@
private boolean jbossFourDotTwo;
+ private boolean jbossFive;
+
private final String securityDomain;
private final String unauthenticatedPrincipal;
@@ -73,9 +85,17 @@
private final List dataSources;
+ private final String libraryDirectory;
- public JbossConfiguration( String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,
- String loaderRepository, String moduleOrder, List dataSources )
+ private final String loaderRepositoryConfig;
+
+ private final String loaderRepositoryClass;
+
+ private final String configParserClass;
+
+ public JbossConfiguration(String version, String securityDomain, String unauthenticatedPrincipal, String jmxName,
+ String loaderRepository, String moduleOrder, List dataSources, String libraryDirectory,
+ String loaderRepositoryConfig, String loaderRepositoryClass, String configParserClass )
throws EarPluginException
{
if ( version == null )
@@ -97,6 +117,10 @@
{
this.jbossFourDotTwo = true;
}
+ else if ( version.equals( JbossConfiguration.VERSION_5) )
+ {
+ this.jbossFive = true;
+ }
else
{
throw new EarPluginException(
@@ -108,6 +132,10 @@
this.loaderRepository = loaderRepository;
this.moduleOrder = moduleOrder;
this.dataSources = dataSources;
+ this.libraryDirectory = libraryDirectory;
+ this.loaderRepositoryConfig = loaderRepositoryConfig;
+ this.loaderRepositoryClass = loaderRepositoryClass;
+ this.configParserClass = configParserClass;
}
}
@@ -153,6 +181,16 @@
}
/**
+ * Returns true if the targeted JBoss version is 5.
+ *
+ * @return if the targeted version is 5
+ */
+ public boolean isJbossFive()
+ {
+ return jbossFive;
+ }
+
+ /**
* The security-domain element specifies the JNDI name of the security
* manager that implements the EJBSecurityManager and RealmMapping for
* the domain. When specified at the jboss level it specifies the security
@@ -204,7 +242,7 @@
* in the ear. It is a unique JMX ObjectName string.
*
* Example:
- * jboss.test:loader=cts-cmp2v1-sar.ear
+ * <loader-repository>jboss.test:loader=cts-cmp2v1-sar.ear</loader-repository>
*
* @return the object name of the ear mbean
*/
@@ -228,7 +266,8 @@
*
* Returns null if no module order is set.
*
- * Only available as from JBoss 4.2.
+ * Only available in JBoss 4.2 and 4.3. Has no effect in JBoss 5 and is
+ * not added when mentioned version is used.
*
* @return the module order
*/
@@ -249,4 +288,62 @@
return dataSources;
}
+ /**
+ * Returns the library directory to include in the jboss-app.xml file.
+ * It tells JBoss where to find non-Java EE libraries included in the EAR.
+ *
+ * @return the library directory
+ */
+ public String getLibraryDirectory()
+ {
+ return libraryDirectory;
+ }
+
+ /**
+ * Returns the class loader repository configuration to include in the jboss-app.xml file.
+ * The content of this element is handed to the class loader, thereby altering it's default behaviour.
+ *
+ * This element is added as a child to the loader-repository element. If the element is not
+ * present in the configuration, it will be added.
+ *
+ * Example: <loader-repository-config>java2ParentDelegaton=true</loader-repository-config>
+ *
+ * @return the class loader repository configuration
+ */
+ public String getLoaderRepositoryConfig()
+ {
+ return loaderRepositoryConfig;
+ }
+
+ /**
+ * Returns the class loader repository class to include in the jboss-app.xml file.
+ * It tells JBoss which loader repository implementation to use.
+ *
+ * This element is added as an attribute to the loader-repository element, therefore it is
+ * not added if no such element configuration is present.
+ *
+ * Example: <loader-repository-class>org.mindbug.jboss.AlternateLoaderRepository</loader-repository-class>
+ *
+ * @return the class loader repository class
+ */
+ public String getLoaderRepositoryClass()
+ {
+ return loaderRepositoryClass;
+ }
+
+ /**
+ * Returns the class loader's configuration parser class to include in the jboss-app.xml file.
+ * It tells JBoss how to parse the configuration given in the loader-repository-config element.
+ *
+ * This element is added as an attribute to the loader-repository-config element, therefore it is
+ * not added if no such element configuration is present.
+ *
+ * Example: <config-parser-class>org.mindbug.jboss.AlternateLoaderRepositoryConfigParser</config-parser-class>
+ *
+ * @return the class loader's configuration parser class
+ */
+ public String getConfigParserClass()
+ {
+ return configParserClass;
+ }
}
Index: src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
===================================================================
--- src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java (revision 745666)
+++ src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java (working copy)
@@ -521,4 +521,57 @@
content.indexOf("${application.name} ${project.version}") != -1);
}
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing library directory.
+ */
+ public void testProject048()
+ throws Exception
+ {
+ doTestProject( "project-048", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 4.2 configuration containing a library directory.
+ */
+ public void testProject049()
+ throws Exception
+ {
+ doTestProject( "project-049", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a loader repository configuration definition.
+ */
+ public void testProject050()
+ throws Exception
+ {
+ doTestProject( "project-050", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a loader repository class definition.
+ */
+ public void testProject051()
+ throws Exception
+ {
+ doTestProject( "project-051", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing a configuration parser class definition.
+ */
+ public void testProject052()
+ throws Exception
+ {
+ doTestProject( "project-052", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
+
+ /**
+ * Builds an EAR with a Jboss 5 configuration containing only the loader repo configuration
+ */
+ public void testProject053()
+ throws Exception
+ {
+ doTestProject( "project-053", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
+ }
}
Index: src/test/resources/projects/project-048/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-048/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-048/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-048
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-048/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-048/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-048/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,26 @@
+
+
+
+
+
+ /APP-INF/lib
+
\ No newline at end of file
Index: src/test/resources/projects/project-048/pom.xml
===================================================================
--- src/test/resources/projects/project-048/pom.xml (revision 0)
+++ src/test/resources/projects/project-048/pom.xml (revision 0)
@@ -0,0 +1,58 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-048
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 5
+ /APP-INF/lib
+
+
+
+
+
+
Index: src/test/resources/projects/project-049/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-049/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-049/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-049
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-049/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-049/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-049/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,26 @@
+
+
+
+
+
+ /APP-INF/lib
+
\ No newline at end of file
Index: src/test/resources/projects/project-049/pom.xml
===================================================================
--- src/test/resources/projects/project-049/pom.xml (revision 0)
+++ src/test/resources/projects/project-049/pom.xml (revision 0)
@@ -0,0 +1,58 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-049
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 4.2
+ /APP-INF/lib
+
+
+
+
+
+
Index: src/test/resources/projects/project-050/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-050/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-050/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-050
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-050/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-050/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-050/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+
+
+
+ abcdef
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-050/pom.xml
===================================================================
--- src/test/resources/projects/project-050/pom.xml (revision 0)
+++ src/test/resources/projects/project-050/pom.xml (revision 0)
@@ -0,0 +1,59 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-050
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 5
+ abc
+ def
+
+
+
+
+
+
Index: src/test/resources/projects/project-051/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-051/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-051/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-051
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-051/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-051/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-051/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,26 @@
+
+
+
+
+
+ abc
+
\ No newline at end of file
Index: src/test/resources/projects/project-051/pom.xml
===================================================================
--- src/test/resources/projects/project-051/pom.xml (revision 0)
+++ src/test/resources/projects/project-051/pom.xml (revision 0)
@@ -0,0 +1,59 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-051
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 5
+ abc
+ def
+
+
+
+
+
+
Index: src/test/resources/projects/project-052/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-052/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-052/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-052
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-052/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-052/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-052/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+
+
+
+ abcghi
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-052/pom.xml
===================================================================
--- src/test/resources/projects/project-052/pom.xml (revision 0)
+++ src/test/resources/projects/project-052/pom.xml (revision 0)
@@ -0,0 +1,61 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-052
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 5
+ abc
+ def
+ ghi
+ jkl
+
+
+
+
+
+
Index: src/test/resources/projects/project-053/expected-META-INF/application.xml
===================================================================
--- src/test/resources/projects/project-053/expected-META-INF/application.xml (revision 0)
+++ src/test/resources/projects/project-053/expected-META-INF/application.xml (revision 0)
@@ -0,0 +1,32 @@
+
+
+
+
+
+ maven-ear-plugin-test-project-053
+
+ ejb-sample-one-1.0.jar
+
+
+ ejb-sample-two-1.0.jar
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-053/expected-META-INF/jboss-app.xml
===================================================================
--- src/test/resources/projects/project-053/expected-META-INF/jboss-app.xml (revision 0)
+++ src/test/resources/projects/project-053/expected-META-INF/jboss-app.xml (revision 0)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ abc
+
+
\ No newline at end of file
Index: src/test/resources/projects/project-053/pom.xml
===================================================================
--- src/test/resources/projects/project-053/pom.xml (revision 0)
+++ src/test/resources/projects/project-053/pom.xml (revision 0)
@@ -0,0 +1,58 @@
+
+
+
+
+ 4.0.0
+ ear
+ maven-ear-plugin-test-project-053
+ 99.0
+ Maven
+ ear
+
+
+ eartest
+ ejb-sample-one
+ 1.0
+ ejb
+
+
+ eartest
+ ejb-sample-two
+ 1.0
+ ejb
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-ear-plugin
+ @project.version@
+
+
+ 5
+ abc
+
+
+
+
+
+