views:

483

answers:

3

I have an ANT build script that deploys a WAR folder into my JBOSS deploy directory. Can I convert that into an executable WAR/JAR file and run it as well?

For example if my folder is called: MYAPP.WAR, can I generate: NEWAPP.WAR where NEWAPP.WAR is an executable file. If i just place it in the Jboss directory and start JBOSS will it pick it up? Should I rename the original folder to something else first to test?


EDIT: Sorry, it seems I was not very clear. The reason I am asking this is because I am trying to use Crystal Reports for Eclipse. When I create a new project, using their plug-in, it works fine, the problem comes when I manually add the libraries to an existing Dynamic Web Project. This is because the plugin requires Jboss to deploy the project. In doing so, Jboss takes the full project and deploys it in a new WAR file. The problem is that this particular project is designed to EXTEND an existing application. So what I normally do is to deploy my code via an ant script that places all files under an existing WAR folder and start Jboss from Eclipse but I DON'T configure it to deploy, it simply starts the App because the WAR folder is there.

When using the Crystal Reports plugin, this is what happens: 1) If I configure the Project to be deployed, I of course get errors, since my Eclipse project DOES NOT include all config files (like XML, etc) which are part of the original project. I don't want to include them in the extension project since it would affect my whole source control scripts. 2) If I update my Ant script tin simply include all classes and files added by crystal report I get a ZipException. When going through the code, it seems that the Crystal Reports code assumes that code was deployed in a single WAR file and is trying to extract the required config and report files, but since the project was deployed in a War folder, this of course fails.

So my rationale in asking this question is: Maybe if I convert the WAR folder that I create with my ANT script to a single WAR file, the Crystal Reports code would work.

Ideas? Are you all even MORE confused?

A: 

You seem to be confusing two concepts here:

WAR file is used to package a web application. It makes no sense without (and will not run outside of) application server or servlet container. There is no such thing as "executable" WAR file; however it can indeed be hot-deployed (e.g. deployed as soon as it's dropped into a designated folder without container restart) as long as container is configured appropriately.

JAR file is used to package a set of classes and / or resources, possibly constituting an application. It's possible to declare an entry point in JAR file's manifest so that running java -jar jar_file_name would result in specified entry class to be launched. In OS's that associate java -jar ... by default to .jar file extension launching the jar directly (from command line / by double clicking / etc...) is possible. That's what got it the name "executable jar".

ChssPly76
A: 

It seems that you mean something other than most people when you say "executable". If you have a directory called MYAPP.WAR that automatically deployes when you place it in the deployment directory, you can just zip it (zip _MYAPP.WAR MYAPP.WAR) and deploy _MYAPP.WAR by placing it in the deployment directory. And yes, you should probably undeploy MYAPP.WAR before doing so.

You can also create an archive that is both an executable JAR file and deployable WAR file at the same time. Hudson does this, and you can probably find out how they are doing it by studying their WAR file.

Tuure Laurinolli
A: 

I don't understand your question much, but perhaps JBoss Embedded is what you are looking for.

http://www.jboss.org/community/wiki/EmbeddedJBoss

Ondra Žižka