8 Replies Latest reply on Mar 6, 2009 5:24 AM by Wolfgang Knauf

    ant.jar in JBOSS Application server

    newcomer s Newbie

      I want to replace some text in the one of the file in war file that I have deployed in JBOSS AS. For this I am using ANT tool. But I do not want to use all files of ANT tool. I will be using only ant.jar and ant-launcher.jar files for replacing text.
      Can I copy only ant.jar and ant-launcher.jar to JBOSS AS lib folder and invoke my build file whenever I need? Build file will be placed in outside JBOSS AS folder..

        • 1. Re: ant.jar in JBOSS Application server
          jaikiran pai Master

           

          Can I copy only ant.jar and ant-launcher.jar to JBOSS AS lib folder and invoke my build file whenever I need? Build file will be placed in outside JBOSS AS folder..


          Why do you want to place those in the JBoss lib folder? And when you say you are replacing text, are you doing this programatically?

          I am a bit confused, because Ant is an external build tool and i don't see a direct relation between it and the AS.


          • 2. Re: ant.jar in JBOSS Application server
            newcomer s Newbie

            I am packaging a war file and a set of other 3rd party files required to run my application. After deploying the war file in JBOSS I need to update a file in war file with new parameters. War file is created using ANT tool. But file modification needs to be done at the user end where ANT is not necessary. So war file must be unzipped, update the required file and zip it back to war file whenever it is necessary.
            So just to avoid using entire ANT tool, I want to know whether I can package only the required jar files of ANT in my application. Also I found that license text of Apache 2.0 is already available in JBOSS AS.

            • 3. Re: ant.jar in JBOSS Application server
              newcomer s Newbie

              Please reply to this query.....

              • 4. Re: ant.jar in JBOSS Application server
                Wolfgang Knauf Master

                Hi,

                this use case sounds a bit strange ;-). You mean that your customer deploys the WAR to JBoss, and when deploying the WAR it is regenerated with a changed config?

                This is probably hardly possible, because JBoss would deploy the app another time when the new WAR is created, and thus your ant task is starting again.

                Why not providing your customer with an "installer", which runs ant and creates the WAR, a the WAR is finally copied to JBoss?

                Best regards

                Wolfgang

                • 5. Re: ant.jar in JBOSS Application server
                  newcomer s Newbie

                  I am providing the installer which contains war file and a couple of other files.
                  At the time of installation, user will be entering some values using which one of the files in war file needs to be updated. As this updates happen at runtime, I need to unpackage war file, update and pack it back. For this I need ANT. Please let me know whether I can package only two ant jar files in my installer instead of entire ANT tool.

                  • 6. Re: ant.jar in JBOSS Application server
                    jaikiran pai Master

                     

                    "newcomer4" wrote:
                    Please let me know whether I can package only two ant jar files in my installer instead of entire ANT tool.


                    Its still not completely clear as to how you are triggering the ANT tool? Using some java program or through the ant scripts? If its through scripts, then you need to ship those too (and maybe a lot of other things) and not just those jars.

                    Again, packaging these jars or the tool itself "inside" the JBossAS is not the right thing to do.


                    • 7. Re: ant.jar in JBOSS Application server
                      jaikiran pai Master

                       

                      "newcomer4" wrote:

                      Can I copy only ant.jar and ant-launcher.jar to JBOSS AS lib folder and invoke my build file whenever I need?
                      ...
                      I am providing the installer which contains war file and a couple of other files.
                      At the time of installation, user will be entering some values using which one of the files in war file needs to be updated. As this updates happen at runtime, I need to unpackage war file, update and pack it back.


                      Consider this - the user uses your tool to create the deployable (.war) on a system which does not have JBoss AS installed. The point i am making is, whatever installer that you are creating/packaging should not be within the AS.

                      • 8. Re: ant.jar in JBOSS Application server
                        Wolfgang Knauf Master

                        Hi,

                        then place the ant JARs in WEB-INF\lib of your web application.

                        But I strongly advice to think again about your use case. Don't create a self-modifying web app, which will contain the ANT jars for the rest of it's lifetime though they are unused. Create a standalone application (e.g. in a JAR, containing ANT), which will start without JBoss connection and which will create a WAR file as output. This WAR file (without ANT files) should be deployed to JBoss.

                        Or convince me that you really need ANT inside your web app ;-)

                        Wolfgang