Uploaded image for project: 'WildFly Maven Plugin'
  1. WildFly Maven Plugin
  2. WFMP-90

Plugin should use downloaded instance as home for all commands

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Final
    • 1.2.0.Final
    • Maven Plugin
    • None

      On my environment there is a JBOSS_HOME variable already set, pointing to an instalation of JBoss that I don't want to use for this maven project. I want the wildfly:run goal to download and use the version specified in <artifact>.

      <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <version>1.2.0.Final</version>
        <configuration>
          <artifact>org.wildfly:wildfly-dist:10.1.0.Final</artifact>
            <beforeDeployment>
              <commands>
                <command>module add --name=com.oracle --resources=${ojdbc7.jar} --dependencies=javax.api,javax.transaction.api</command>
                <command>/subsystem=datasources/jdbc-driver=oracle:add(driver-name="oracle",driver-module-name="com.oracle",driver-class-name=oracle.jdbc.OracleDriver)</command>
              </commands>
            </beforeDeployment>
        </configuration>
      </plugin>
      

      When I run without specifying <jbossHome> in the POM, the plugin executes the "module add" command on the JBoss instance pointed by the environment variable instead of the downloaded WildFly instance.

      If I do specify <jbossHome> with the path where the downloaded WildFly will be ([my_project_path]/target/wildfly-run/wildfly-10.1.0.Final), startup fails because the directory does not yet exists at the moment the check is performed:

      Caused by: org.apache.maven.plugin.MojoExecutionException: JBOSS_HOME '[my_project_path]/target/wildfly-run/wildfly-10.1.0.Final' is not a valid directory.
      at org.wildfly.plugin.server.RunMojo.execute(RunMojo.java:279)

      So, what is working for me is not specifying <jbossHome> on the POM and then unsetting JBOSS_HOME environment variable on the command line before actually executing mvn wildfly:run. I have not found a POM-only configuration that works to ignore the environment variable.

      I think this is very confusing. I think that if the plugin decided that it should download WildFly (because I did not specified <jbossHome>), it should use the downloaded instance as home for deploying and executing all commands (including "module add").

              jperkins-rhn James Perkins
              seuvitor Vitor Dantas (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: