views:

520

answers:

2

I am using maven to configure maven-ear-plugin. I am getting following exception when I say jboss version is 5 (See below code, under tag). It works if I replace version to 4.2

<build>
    <finalName>tactical</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <version>5</version>
                <defaultJavaBundleDir>lib</defaultJavaBundleDir>
                <jboss>
                    <version>5</version>
                    <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
                </jboss>
 <modules>
                    <ejbModule>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>tactical-jar</artifactId>
                    </ejbModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

Why it works fine for jboss 4.2 but not for 5. What ??

I get the following exception:

[INFO] Failed to initialize JBoss configuration

Embedded error: Invalid JBoss configuration, version[5] is not supported. [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Failed to initialize JBoss configuration at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:49 9) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav a:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to initialize JBoss configuration at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:159) at org.apache.maven.plugin.ear.GenerateApplicationXmlMojo.execute(GenerateApplicationXmlMojo.java:96) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) ... 16 more Caused by: org.apache.maven.plugin.ear.EarPluginException: Invalid JBoss configuration, version[5] is not supported. at org.apache.maven.plugin.ear.JbossConfiguration.(JbossConfiguration.java:95) at org.apache.maven.plugin.ear.AbstractEarMojo.initializeJbossConfiguration(AbstractEarMojo.java:296) at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:155) ... 19 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds

Any idea. Thanks

A: 

Which version of the plugin are you using ? The latest source code suggests this should work.

120             else if ( version.equals( JbossConfiguration.VERSION_5 ) )
121             {
122                 this.jbossFive = true;
123             }
124             else
125             {
126                 throw new EarPluginException(
127                     "Invalid JBoss configuration, version[" + version + "] is not supported." );
128             }
Brian Agnew
A: 

The support of JBoss 5 is available in version 2.3.2 and later of the maven ear plugin (see MEAR-102). With your current configuration (without specifying the version of the plugin, which is not recommended for the sake of build reproducibility), you get the version 2.3.1 of the plugin. You can print the "effective pom" to check this by running:

mvn help:effective-pom

In your case, I suggest to use the latest version:

<build>
  <finalName>tactical</finalName>
  <plugins>
    <plugin>
      <artifactId>maven-ear-plugin</artifactId>
      <!-- Lock down plugin version for build reproducibility -->
      <version>2.4.1</version>
      <configuration>
        <version>5</version>
        <defaultJavaBundleDir>lib</defaultJavaBundleDir>
        <jboss>
          <version>5</version>
          <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
        </jboss>
        <modules>
          <ejbModule>
            <groupId>${project.groupId}</groupId>
            <artifactId>tactical-jar</artifactId>
          </ejbModule>
        </modules>
      </configuration>
    </plugin>
  </plugins>
</build>
Pascal Thivent