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).
wow! This looks very cool! Max, you did it again! ;)
Although I must say I am quite happy to no longer have to configure things like this, yet use a framework that enforces a convention for the structure of the project. If only the rest of the tool support would have a quality like the Java tools.
Thanks Sakuraba, just to be clear this functionallity was a team effort back from the JBossIDE team (Rob Stryker doing the final implementation and Marshall and me complaining with bugs)
Your last comment I'm not sure I understand fully ;)
Which framework are you referring to and what are the that does not have quality ?
I am referring to Grails. I am happy to not having to configure the build process according to my project structure, but instead have a convention enforced on it. But of course that comes with a price, too. Grails tool-support is not even close to the tool-support Seam has.
Nevertheless it is great to see that with Seam you can shorten the process of project configuration thanks to JBoss Tools.
Very useful functionality as there are many posts in the forum about the build scripts.
cool feature indeed. Only on my setup I sometimes get unexpected results. Like I just updated components.xml, status switches to Republish and then to Synchronized, I check the contents of the components.xml file in the deploy dir well... nothing changed :S:S. This got me stuck for a few hours...
Report issues in jira and we can work with you on figuring out what is causing it.
I create an jar archive from a general java project, but it does not run incremental build! (war/ear project is OK)
I fixed it by copy the following to .project and it work great! Thanks
<buildCommand> <name>org.jboss.ide.eclipse.archives.core.archivesBuilder</name> <arguments> </arguments> </buildCommand> <nature>org.jboss.ide.eclipse.archives.core.archivesNature</nature>
Is there a converter between the JBoss AS Tools 1.1 to JBoss AS Core Tools 3.0? I'm having problems upgrading!
Thanks
is there a special setting which needs enabled for the archiving to happen automatically? i currently have a project setup to deploy to an exploded folder, but when i edit a .java file, the archiving isn't updating as expected. (auto-build is enabled.) any thoughts? thanks!