8 Replies Latest reply on Aug 20, 2008 3:22 PM by happyspaceinvader

    JBoss not recognizing deployments from Maven

    happyspaceinvader

      I have some Maven projects set up to deploy to JBoss using the maven-jboss-deploy-plugin as follows:

      <plugin>
       <groupId>org.jboss.maven.plugins</groupId>
       <artifactId>maven-jboss-deploy-plugin</artifactId>
       <version>1.6</version>
       <executions>
       <execution>
       <goals>
       <goal>jboss-deploy</goal>
       </goals>
       </execution>
       </executions>
       <configuration>
       <jbossDeployRoot>/jboss/server/myserver/deploy</jbossDeployRoot>
       <groupId>myproject</groupId>
       <removeArtifactVersion>true</removeArtifactVersion>
       </configuration>
       </plugin>
      


      The problem is that the packages (e.g. my Messaging package) sit at the INIT_WAITING_DEPLOYER stage as follows:

      15:09:29,058 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      
      --- Packages waiting for a deployer ---
      org.jboss.deployment.DeploymentInfo@3a0cd9cd { url=file:/jboss/server/myserver/deploy/myproject/Messaging/1.0-SNAPSHOT/ }
       deployer: null
       status: null
       state: INIT_WAITING_DEPLOYER
       watch: file:/jboss/server/myserver/deploy/myproject/Messaging/1.0-SNAPSHOT/
       altDD: null
       lastDeployed: 1219241364043
       lastModified: 1219241363000
       mbeans:
      


      I am just wondering what is wrong here. The Maven plugin creates a component-info.xml as follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <project name="myproject/Messaging-component-info">
       <component id="myproject/Messaging"
       licenseType="lgpl"
       version="1.0-SNAPSHOT"
       description="net.mycompany.myproject.messaging:Messaging:ejb:1.0-SNAPSHOT"
      
       >
      
       <artifact id="Messaging.jar"/>
      
      
       <export>
       <include input="Messaging.jar"/>
      
       </export>
       </component>
      </project>
      


      Perhaps something is missing from that? If I take the same Messaging.jar and move it to the deploy directory, it deploys just fine.

        • 1. Re: JBoss not recognizing deployments from Maven
          peterj

          Apps are deployed based on their extensions. For example, *.ear is deployed as an enterprise app, *.war is deployed as a web app. This applies whether the app is deployed as an archive file or as an exploded directory. It appears that you are deploying as an exploded directory - but it is missing the extension to identify the type of app it is:

          url=file:/jboss/server/myserver/deploy/myproject/Mess
          aging/1.0-SNAPSHOT/

          I would assume that "myproject" requires an extension.

          • 2. Re: JBoss not recognizing deployments from Maven
            peterj

            Doing a more careful read of your post, I would suspect that you want "Messaging" to end with the .jar extension. I also suspect that you want to know how to convince Maven to copy your Messaging.jar file to the deploy directory. For that I don't know - I use Ant to do all of my deploying, even if I build with Maven.

            • 3. Re: JBoss not recognizing deployments from Maven
              happyspaceinvader

               

              "PeterJ" wrote:
              Doing a more careful read of your post, I would suspect that you want "Messaging" to end with the .jar extension. I also suspect that you want to know how to convince Maven to copy your Messaging.jar file to the deploy directory. For that I don't know - I use Ant to do all of my deploying, even if I build with Maven.


              I'm not sure that's it - that Messaging directory name is taken straight from the artifactId in the Maven pom.xml. You wouldn't normally put the .jar/.ear etc. extension in there.

              I think the way this is supposed to work is that it depends on the component-info.xml, but my copy of that file has been incorrectly generated because I am missing some essential setting in the maven-jboss-deploy-plugin configuration.

              • 4. Re: JBoss not recognizing deployments from Maven
                peterj

                But doesn't your Maven build place a Messaging.jar (or perhaps Messaging-1.0-SNAPSHOT.jar) into your target directory? I would think that the maven-jboss-deploy-plugin would use that when it has to deploy somthing.

                Crazy question - where is your project directory located? I hope that it is not at /jboss/server/myserver/deploy/myproject.

                • 5. Re: JBoss not recognizing deployments from Maven
                  happyspaceinvader

                   

                  "PeterJ" wrote:
                  But doesn't your Maven build place a Messaging.jar (or perhaps Messaging-1.0-SNAPSHOT.jar) into your target directory? I would think that the maven-jboss-deploy-plugin would use that when it has to deploy somthing.


                  It does place a Messaging.jar in /jboss/server/myserver/deploy/myproject/Messaging/1.0-SNAPSHOT/lib. This is why I am surprised that JBoss does not pick it up. If I move that jar file to any other set of nested directories under the deploy directory, JBoss sees it and deploys it successfully. JBoss seems to know to watch the ...myproject/Messaging/1.0-SNAPSHOT/ directory as you can see from the above logs. This is why I think the component-info.xml is preventing JBoss from deploying this package... due to missing information.

                  I've tried to find some more information on what that file actually needs, but haven't found anything conclusive. Also, I am limited to what I can pass in via the maven plugin, but this plugin has been developed by JBoss and is at version 1.6, so I would have thought that it works enough to allow something simple like a JAR to be deployed.

                  "PeterJ" wrote:

                  Crazy question - where is your project directory located? I hope that it is not at /jboss/server/myserver/deploy/myproject.


                  That is where it is deployed to. The build project directory is somewhere completely different.

                  • 6. Re: JBoss not recognizing deployments from Maven
                    peterj

                    The issue is the name of the directory 1.0-SNAPSHOT. Note the extension - ".0-SNAPSHOT" There is no deployer for that extension. Only if the directory name has no extension will it be ignored (by the deployer). Well, not really ignored - the main deployed will scanning the directory looking for things to deploy.

                    • 7. Re: JBoss not recognizing deployments from Maven
                      happyspaceinvader

                       

                      "PeterJ" wrote:
                      The issue is the name of the directory 1.0-SNAPSHOT. Note the extension - ".0-SNAPSHOT" There is no deployer for that extension. Only if the directory name has no extension will it be ignored (by the deployer). Well, not really ignored - the main deployed will scanning the directory looking for things to deploy.


                      Ah, I see. Then this is surely something of a design flaw in the jboss/maven deployment plugin, whose default behaviours is to name the directory after the version number? In fact, I'm not even sure if there's a way to override this, but I will endeavour to find out. I'm already setting "removeArtifactVersion" to true, but this seems only to remove the version number for the JAR file, not the directory path.

                      • 8. Re: JBoss not recognizing deployments from Maven
                        happyspaceinvader

                        Ah... forget it... you know what I failed to do... read the full description of the plugin goal, which starts "Maven plugin for deploying to jboss repository."

                        So it's not for deploying packages to JBoss at all. How embarassing.