When I change the packaging of my web project from "bundle" to "war", the
web bundle is no longer included when I run "mvn clean install
pax:provision". Stuart considers this a bug in pax-provision.

In order to get the web bundle to be installed and started, I chose to
specify it explicitly using the deployURLs property. Note that I clear the
cache dir first, to be sure of what's downloaded.

rm -rf runner/
mvn clean install pax:provision
-DdeployURLs=mvn:mygroup/myartifact/1.0-SNAPSHOT/war

The funny thing here is that pax-runner finds the .war in the repo, but
downloads it to a local cached .jar file. Look here:

[INFO] Installing src/myapp/myartifact/target/myartifact-1.0-SNAPSHOT.war to
/Users/ulrik/.m2/repository/mygroup/myartifact/1.0-SNAPSHOT/myartifact-1.0-SNAPSHOT.war
...
 -> Provision from [mvn:mygroup/myartifact/1.0-SNAPSHOT/war]
 -> Provision from [scan-bundle:mvn:mygroup/myartifact/1.0-SNAPSHOT/war]
 -> Installing bundle [{location=mvn:mygroup/myartifact
/1.0-SNAPSHOT/war,startlevel=null,shouldStart=true,shouldUpdate=false}]
 -> Downloading bundles...
 ...
 -> mvn:mygroup/myartifact/1.0-SNAPSHOT/war : 14412 bytes @ [ 4804kBps ]

The started bundle is actually a .jar:

osgi> ss
...
25    ACTIVE      myartifact_1.0.0.SNAPSHOT

osgi> diag 25
[EMAIL PROTECTED]:file:myartifact_1.0.0.SNAPSHOT.jar/ [25]
  No unresolved constraints.

Looking in the bundle cache explains why:

% ls -l runner
...
-rw-r--r--  1 ulrik  staff    14412 14 Jul 03:25
myartifact_1.0.0.SNAPSHOT.jar

It appears that a bundle must always be a .jar, and if it's not, it is
converted into a .jar. Is this really what we want?


On Mon, Jul 14, 2008 at 9:39 AM, Alin Dreghiciu <[EMAIL PROTECTED]>
wrote:

> I was about to tell you yesterday about the fact that even if you get
> the file renamed it will still not work as when pax
> runner/pax:provision will be triggered it will rename the file to
> <bundle-symbolic-name>-<bundle-version>.jar so spring will not pick it
> up anyhow. But I got busy with some other stuff and forgot about.
> From my point of view this is not a bug. It just does not fit the
> spring approach.
>
> On Mon, Jul 14, 2008 at 6:53 AM, Stuart McCulloch
> <[EMAIL PROTECTED]> wrote:
> > 2008/7/14 Ulrik Sandberg <[EMAIL PROTECTED]>:
> >>
> >> A quick test using the war plugin instead of the bundle plugin:
> >>
> >> pax:provision refuses to add the war project to the list of bundles to
> >> download and install.
> >
> > that sounds like a bug - can you raise an issue here:
> >
> >   http://issues.ops4j.org/jira/browse/PAXCONSTRUCT
> >
> > against the maven-pax-plugin component - thanks
> >
> >>
> >> When I eventually got it to do that by using
> >> -DdeployURLs=mvn:group/artifact/version/war, pax:provision seems to
> download
> >> the .war from the repo to a .jar in the local runner dir, and then
> install
> >> the .jar instead.
> >
> > I think this bit is Pax-Runner (see
> > pax-runner-platform/.../PlatformImpl.java)
> >
> >> On Fri, Jul 11, 2008 at 11:08 PM, Alin Dreghiciu <[EMAIL PROTECTED]>
> >> wrote:
> >>>
> >>> ...
> >>> Now if you really need to still use maven bundle plugin but generate a
> >>> different extension as war you could try to set the <packaging> to war
> >>> and use the instructions under "Adding OSGi metadata to existing
> >>> projects without changing the packaging type" from
> >>> http://felix.apache.org/site/maven-bundle-plugin-bnd.html
> >>> It may work. I never tried.
> >>>
> >>> On Fri, Jul 11, 2008 at 9:28 PM, Ulrik Sandberg
> >>> <[EMAIL PROTECTED]> wrote:
> >>> > The reason I want to do this is that Spring DM 1.1.0-final differs
> from
> >>> > 1.1.0-rc1 in that spring-osgi-web-extender now considers a bundle to
> be
> >>> > a
> >>> > WAR if it ends with .war; previously it only needed to contain a
> >>> > WEB-INF/web.xml. My sample app suddenly stopped working due to that
> >>> > tiny
> >>> > little change...
> >>> >
> >>> >
> >>> > On Wed, Jul 9, 2008 at 11:15 PM, Niclas Hedhman <[EMAIL PROTECTED]>
> >>> > wrote:
> >>> >>
> >>> >> On Thu, Jul 10, 2008 at 3:41 AM, Ulrik Sandberg
> >>> >> <[EMAIL PROTECTED]> wrote:
> >>> >> > I want to change the file name extension for a project that has
> >>> >> > packaging
> >>> >> > "bundle" from ".jar" to ".war". How do I do that?
> >>> >>
> >>> >> On Linux;
> >>> >>
> >>> >> mv abc.jar abc.war
> >>> >>
> >>> >> I think on Windows you press F2 when the jar is selected...
> >>> >>
> >>> >> ;-)
> >>> >>
> >>> >>
> >>> >> Seriously, I don't think it is possible. You could try the
> <finalname>
> >>> >> feature in Maven, but I suspect that it is not totally compatible
> with
> >>> >> the rest of the "supply chain".
> >>> >>
> >>> >> Another choice could be to put in a ant script to copy the file
> under
> >>> >> a new name...
> >>> >>
> >>> >>
> >>> >> Cheers
> >>> >> Niclas
> >>> >>
> >>> >> _______________________________________________
> >>> >> general mailing list
> >>> >> general@lists.ops4j.org
> >>> >> http://lists.ops4j.org/mailman/listinfo/general
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Ulrik
> >>> > _______________________________________________
> >>> > general mailing list
> >>> > general@lists.ops4j.org
> >>> > http://lists.ops4j.org/mailman/listinfo/general
> >>> >
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Alin Dreghiciu
> >>> http://www.ops4j.org - New Energy for OSS Communities - Open
> >>> Participation Software.
> >>> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
> >>> http://malaysia.jayway.net - New Energy for Projects - Great People
> >>> working on Great Projects at Great Places
> >>>
> >>> _______________________________________________
> >>> general mailing list
> >>> general@lists.ops4j.org
> >>> http://lists.ops4j.org/mailman/listinfo/general
> >>>
> >>
> >>
> >>
> >> --
> >> Ulrik
> >> _______________________________________________
> >> general mailing list
> >> general@lists.ops4j.org
> >> http://lists.ops4j.org/mailman/listinfo/general
> >>
> >
> >
> >
> > --
> > Cheers, Stuart
> > _______________________________________________
> > general mailing list
> > general@lists.ops4j.org
> > http://lists.ops4j.org/mailman/listinfo/general
> >
> >
>
>
>
> --
> Alin Dreghiciu
> http://www.ops4j.org - New Energy for OSS Communities - Open
> Participation Software.
> http://www.qi4j.org - New Energy for Java - Domain Driven Development.
> http://malaysia.jayway.net - New Energy for Projects - Great People
> working on Great Projects at Great Places
>
> _______________________________________________
> general mailing list
> general@lists.ops4j.org
> http://lists.ops4j.org/mailman/listinfo/general
>
>


-- 
Ulrik
_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to