users@glassfish.java.net

Re: Glassfish, OSGi and Eclipse

From: CasMeiron <casmeiron_at_gmail.com>
Date: Sun, 12 Sep 2010 16:42:25 -0300

Hello,

I've created an easy way to deploy osgi bundle files to glassfish (well,
better than manual method).

Include this in your pom:

<plugin>
 <groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
 <version>1.0-rc-5</version>
<executions>
<execution>
 <id>deploy-osgi-bundle</id>
<phase>install</phase>
 <goals>
<goal>execute</goal>
</goals>
 <configuration>
<source>
def fs = System.getProperty("file.separator")
 def domain = project.properties['glassfish.domain']
 def glassfishBundlePath = new File(project.properties['glassfish.path'],
"glassfish${fs}domains${fs}${domain}${fs}autodeploy${fs}bundles${fs}")
 def resultArtifact = new File(project.build.directory,
"${project.build.finalName}.${project.packaging}")
def copyTo = new File(glassfishBundlePath, resultArtifact.getName())
 println ("[OSGI-BUNDLE-INSTALL] : Copyin' bundle file ${resultArtifact} to
${copyTo} ...")
def ant = new AntBuilder()
 ant.copy(
file:resultArtifact,
tofile:copyTo
 )
</source>
</configuration>
 </execution>
</executions>
</plugin>

Config the glassfish directory on your pom:

<properties>
<glassfish.path>D:\\Developer\\web-containers\\glassfish-v3.1\\</glassfish.path>
 <glassfish.domain>domain1</glassfish.domain>
</properties>

And you can deploy using the follow command: mvn install

Another way is to create a builder to eclipse so it can deploy automatically
when any source changes. To accomplish that just create new builder for your
project and select external program (in this case, maven) and configure it
to run install on the variable project_loc so you're good to go.

Hope it helps you at least a little.

-------------------------------
Paulo Reis




On Sun, Sep 12, 2010 at 11:42 AM, <glassfish_at_javadesktop.org> wrote:

> Hmm, yes, that would work for [i]one[/i] bundle...
>
> But I'm thinking of an application with 20 or more bundles.
>
> Some background for my original question:
>
> I have an OSGi application with ~50 bundles, running on Equinox, developed
> in Eclipse PDE, using Declarative Services for injection and JPA in
> stand-alone mode with user-level transactions.
>
> It would save me a lot of repetitive code if my container (be it OSGi, or
> Java EE, or a combination of both, or anything else) would inject the
> persistence context and manage the transactions automatically, which is
> standard in Java EE but not in OSGi.
>
> However; I'd rather stick with my manual transactions and naked OSGi if
> there is no decent tooling for OSGi development on Glassfish (or any other
> server).
>
> Best regards,
> Harald
> [Message sent by forum member 'hwellmann']
>
> http://forums.java.net/jive/thread.jspa?messageID=482451
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>