3 Replies Latest reply on Jun 17, 2011 8:51 AM by wolfgangknauf

    How can I run a batch job when start Jboss in eclipse?

    eric.v.frey

      I use JBoss AS 5.0 with eclipse 3.6. I start Jboss inside eclipse, the problems is, eclipse start jboss by direclty calling run.jar, and I need to do some assembling job(file copying etc.) each time when I start the server, there's not where I can put this operation when I click the start button, are there any ways to run some pre-proccessing tasks before calling run.jar?

        • 1. Re: How can I run a batch job when start Jboss in eclipse?
          wolfgangknauf

          Hi,

           

          do you use Eclipse Web Tools Platform, or do you use JBoss Tools plugin?

           

          If you use the WTP plugin: take a look at the file "%ECLIPSE_HOME%\plugins\org.eclipse.jst.server.generic.jboss_1.6.1.v200904151730\servers\jboss5.serverdef": here you find the configuration for the JBoss startup job:

           

           

          {code:xml}


          <start>


          <mainClass>org.jboss.Main</mainClass>


          <workingDirectory>${serverRootDirectory}/bin</workingDirectory>


          <programArguments>-c ${serverConfig}</programArguments>


          <vmParameters>-Dprogram.name=run.bat -Xms128m -Xmx512m  -XX:MaxPermSize=256m</vmParameters>


          <classpathReference>jboss</classpathReference>

          </start>

          {code}

           

          Maybe this is a starting point to do further research. You might call e.g. a custom java program which performs your tasks and then chains the server startup call.

           

          I know that this is not the solution for your question, but hopefully it provides some startup help.

           

          Wolfgang

          • 2. Re: How can I run a batch job when start Jboss in eclipse?
            eric.v.frey

            I know that this is not the solution for your question, but hopefully it provides some startup help.

             

            Actually, this is really the solution of my problem. And I use jboss byteman to intercept this main method. start a proecess and call my bat file.

            Other things I can do might be writting my own eclipse plugin and handle the behavior the wtp jboss plugin, which is too far from what I want.

             

             

            do you use Eclipse Web Tools Platform?

            Yes I use WTP, in the server settting tab, there's a section called Ant Publisher Properties, it seems you can specify an Ant build file before launching the server, is it right? How to use that function, whenever I specify a build file, it says property not found.

            • 3. Re: How can I run a batch job when start Jboss in eclipse?
              wolfgangknauf

              Sorry, never used the "Ant publisher properties" options ;-).

               

              Wolfgang