One of my favorite feature in JBoss Tools is the Project Archives which provides automatic and incremental archiving of arbitrary directories into a zipped archive (jar,zip,war,etc) or into an exploded directory. Usable for any development that wants hot and/or exploded deployment.

A screen cast is available at docs.jboss.org, but if you want the details read the following...

Project Archives View

To start using it you open the Project archives view, select a project and right click in the view to add the type of jar you want (each project can have multiple archives defined).

In the dialog that comes up you specify what the name of the archive should be, where it should be located and whether the folder should be archived/compressed or exploded.

The tools will dependent on the archive type and project files give a best-guess on which files you would like to include in the archive. You can of course customize this freely afterwards.

When you have pressed Ok, you will be able to see the resulting archive or folder in Eclipse or if you configured it to go the file system use your favorite file browser to see the result.

Automatic Incremental packaging

When first defined through the Project archives view JBoss Tools will automatically monitor changes and keep the archive or folder in sync. Since the changes and archiving is done incrementally there are no need to wait for Ant or Maven to collect the various artifacts and do a full archiving.

I suggest watching the screen cast to get a sense of how easy and fast this works.

Exploded jars

The exploded archive support allows you to use this with any server that supports what is called exploded deployment (commonly used with many Java and non-java servers) - thus this is in no way limited to JBoss servers or even Java technology; any technology that needs to copy a set of files to a directory or archive will be able to benefit from this feature.

What about JBossIDE packaging ?

JBossIDE 1.x had a similar feature which relied on generating an ant script and execute Ant to do the actual packaging.

The advantages of the new Project Archives is that it does not wait for a launch of Ant and instead of doing a full build/repackaging of a compressed archive every time, we can now do it incrementally and with the option of exploded form.

To migrate from JBossIDE packaging to JBoss Tools archiving you can use the conversion tool which we made available at download.jboss.org.

The conversion is as simple as:

java -jar packaging-converter.jar /path/to/.packaging

Ant and Maven

To avoid specifying how packaging works twice, once in JBoss Tools and once in your favorite build system we added an ant task to allow you to use it externally from Eclipse.

The following is an example of how that is used:

<property name="studio.home" location="${eclipse.home}/../studio/eclipse"/>

 <path id="generate-archives-classpath">
  <fileset dir="${eclipse.home}/plugins">
   <include name="org.eclipse.equinox.common_*.jar"/>                                    
  </fileset>
  <fileset dir="${studio.home}">
   <include name="plugins/org.jboss.ide.eclipse.archives.core**/archivescore.jar"/>
   <include name="plugins/org.jboss.ide.eclipse.archives.core**/lib/*.jar"/>         
  </fileset>
</path>
                 
 <taskdef name="generate-archives" classpathref="generate-archives-classpath"       
classname="org.jboss.ide.eclipse.archives.core.ant.GenerateArchivesTask"/>
         
<target name="run-packaging">
 <!-- each project needs to have their root dir defined when running outside eclipse -->
 <property name="pojp.dir" value="C:/Users/max/workspace/pojp"/>
 <generate-archives projectPath="C:/Users/max/workspace/pojp"/>
</target>

Final words

Thanks goes out to Rob for showing me how the Ant task works and for Marshall to get the conversion script ready. We hope to integrate that more directly into JBoss Tools in an upcoming release.

If you want to see this in live action look me up at JavaPolis next week (in the JBoss/Red Hat booth).


Back to top