3 Replies Latest reply on Apr 26, 2016 11:38 AM by jamezp

    jboss-as-maven-plugin changing deployment folder

    carcaret

      I'm using jboss-as-maven-plugin to deploy an application to my local JBoss EAP 6.1+ server using the following code:

      <plugin>

      <groupId>org.jboss.as.plugins</groupId>

      <artifactId>jboss-as-maven-plugin</artifactId>

      <version>7.7.Final</version>

      <configuration>

      <jboss-home>C:/Users/user/Software/jbdevstudio/runtimes/jboss-eap</jboss-home>

      </configuration>

      </plugin>

      My issue comes because the app is first deployed into this folder (A):

      C:\Users\user\Software\jbdevstudio\runtimes\jboss-eap\bin\content\myapp.war\

      And when the deployment finishes, it's being copied to this one (B):

      C:\Users\user\Software\jbdevstudio\runtimes\jboss-eap\standalone\tmp\vfs\temp\temp99a677decc64238a\content-2afbd3c37fb9c431\

      Then, when I try to read a file that is in the classpath:

      URL urlFilePath = this.getClass().getResource(fileName);

      I get a path that points to folder A, so creating an InputStream is throwing a FileNotFoundException since now that file is in folder B.

      Is there a workaround or a way to avoid the deployment being copied?

        • 1. Re: jboss-as-maven-plugin changing deployment folder
          jamezp

          The plugin deploys the archive. It doesn't deploy exploded content.

           

          You can probably get what you're after if you use the gerResourceAsStream() instead.

          final InputStream in = this.getClass().getResourceAsStream(fileName);
          

           

          --

          James R. Perkins

          • 2. Re: jboss-as-maven-plugin changing deployment folder
            carcaret

            Thank you James, that did work, but I don't understand why. Shouldn't

             

            this.getClass().getResource(fileName)
            

             

            return the path to the file on disk (it is actually on disk in C:\Users\user\Software\jbdevstudio\runtimes\jboss-eap\standalone\tmp\vfs\temp\tempe7d3b1b185b33880\content-3cbb473e621bf4f3\WEB-INF\classes)?

             

            What means that the plugin deploys the archive, not the exploded content?

             

            Is there a way to deploy the application so that this line will work using the plugin? I can't change the source code to use getResourceAsStream().

            • 3. Re: jboss-as-maven-plugin changing deployment folder
              jamezp

              The plugin only deploys the archive. It doesn't support deploying exploded content.

               

              --
              James R. Perkins