You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "Craig L. Ching" <cc...@mqsoftware.com> on 2009/04/02 18:15:02 UTC

Bundle packaging conflicts with mvn release?

Hi all,

This is probably more of a general maven question, but I'm going to
start here in case anyone has any quick insight into what my problem
might be.

I've changed the packaging in my jars to bundle and added the OSGi
manifests using maven-bundle-plugin in anticipation of moving our app to
an OSGi environment.  'mvn clean install' works fine all day long,
however, when I go to do a release with 'mvn release:prepare
-DautoVersionSubmodules=true', I get the following:

[INFO] [INFO] Failed to resolve artifact.
[INFO]
[INFO] Missing:
[INFO] ----------
[INFO] 1) com.mqsoftware.appwise:appwise-security:jar:1.0.0.10
[INFO]
[INFO]   Try downloading the file manually from the project website.
[INFO]
[INFO]   Then, install it using the command:
[INFO]       mvn install:install-file -DgroupId=com.mqsoftware.appwise
-DartifactId=appwise-security -Dversion=1.0.0.10 -Dpackaging=jar
-Dfile=/path/to/file
[INFO]
[INFO]   Alternatively, if you host your own repository you can deploy
the file there:
[INFO]       mvn deploy:deploy-file -DgroupId=com.mqsoftware.appwise
-DartifactId=appwise-security -Dversion=1.0.0.10 -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[INFO]
[INFO]   Path to dependency:
[INFO]          1) com.mqsoftware.appwise:appwise-core:bundle:1.0.0.10
[INFO]          2) com.mqsoftware.appwise:appwise-security:jar:1.0.0.10
[INFO]
[INFO] ----------
[INFO] 1 required artifact is missing.
[INFO]
[INFO] for artifact:
[INFO]   com.mqsoftware.appwise:appwise-core:bundle:1.0.0.10
[INFO]
[INFO] from the specified remote repositories:
[INFO]   central (http://repo1.maven.org/maven2),
[INFO]   cerberus-snapshots (http://cerberus:8081/artifactory/repo),
[INFO]   cerberus-central (http://cerberus:8081/artifactory/repo)

(appwise-security and appwise-core are both bundles, this happens when
we're building appwise-core which depends on appwise-security.)

This only happens with the bundle packaging, changing the packaging back
to jar (by removing the <packaging></packaging> elements altogether)
makes mvn release work.

So, the reason I say it's probably a general maven issue and a
misunderstanding on my part is because it's looking at remote
repositories instead of in my workspace and I don't understand why.  But
the reason I'm asking here is because it happens when I use
'<packaging>bundle</packaging>' and I'm hoping I get a better/quicker
answer here ;-)

Thanks for any help!

Cheers,
Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Bundle packaging conflicts with mvn release?

Posted by "Craig L. Ching" <cc...@mqsoftware.com>.
Sorry Stuart, I got your reply, but I accidentally fat-fingered the
reply and deleted it instead :-(  So I'm responding to myself here:

> So, if this is a bug, I'm actually thinking of using 
> maven-bundle-plugin's ability to keep my jar packaging and 
> use the jar plugin to add the manifest, that should work in 
> theory, right?
> 

Worked like a charm ;-)  Thanks for your help Stuart!

> > --
> > Cheers, Stuart
> > 
> > 
> 
Cheers,
Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Bundle packaging conflicts with mvn release?

Posted by "Craig L. Ching" <cc...@mqsoftware.com>.
 

> -----Original Message-----
> From: Tim Moore [mailto:tmoore@atlassian.com] 
> Sent: Monday, April 06, 2009 1:11 PM
> To: users@felix.apache.org
> Subject: Re: Bundle packaging conflicts with mvn release?
> 
> We've successfully done multi-module releases with a mix of 
> bundle packaging and normal jars. We've discovered that the 
> key for handling bundle dependencies correctly is:
> 
> a) The bundle artifact should use <packaging>bundle</packaging>
> b) The dependency should use <type>bundle</type>
> c) The pom with the dependency needs to *also* include the 
> bundle plugin, with <extensions>true</extensions>. If you're 
> missing this, that's what will cause it to look for artifacts 
> with a .bundle extension.
> 
> The easiest thing we've found is to put the plugin 
> declaration in the parent pom for the multi-module project:
> 
> ...
>      <build>
>          <pluginManagement>
>              <plugins>
>                  <plugin>
>                      <groupId>org.apache.felix</groupId>
>                      <artifactId>maven-bundle-plugin</artifactId>
>                      <extensions>true</extensions>
>                      <version>1.4.3</version>
>                  </plugin>
> ...
>              </plugins>
>          </pluginManagement>
>          <plugins>
>              <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>              </plugin>
>          </plugins>
>      </build>
> ...
> 
> This ensures that all of the modules in the project inherit 
> the same configuration and have the plugin activated.
> 

Thanks Tim, I'll give that a try.  I'm sure I have tried that
suggestion, but it is possible that I missed one thing here or there
when I did it.  I seem to recall having trouble with the 'type' element
in particular.  But I'll give it a try again.

> Cheers,
> 
> --
> Tim Moore

Cheers,
Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle packaging conflicts with mvn release?

Posted by Tim Moore <tm...@atlassian.com>.
On Apr 2, 2009, at 9:55 AM, Craig L. Ching wrote:

>> have you tried setting the type of your dependency to be
>> bundle? ie. in the "com.mqsoftware.appwise:appwise-core" pom,
>> it would look like this:
>>
>>  <dependency>
>>    <groupId>com.mqsoftware.appwise</groupId>
>>    <artifactId>appwise-security</artifactId>
>>    <version>1.0.0.10</version>
>>    <type>bundle</type>
>>  </dependency>
>>
>> this might resolve the problem - alternatively try releasing
>> one at a time...
>>
> Yeah, I tried that but it didn't find the bundle.  I *think* it was
> looking for a .bundle extension, but I might be misremembering.
>
>

We've successfully done multi-module releases with a mix of bundle  
packaging and normal jars. We've discovered that the key for handling  
bundle dependencies correctly is:

a) The bundle artifact should use <packaging>bundle</packaging>
b) The dependency should use <type>bundle</type>
c) The pom with the dependency needs to *also* include the bundle  
plugin, with <extensions>true</extensions>. If you're missing this,  
that's what will cause it to look for artifacts with a .bundle  
extension.

The easiest thing we've found is to put the plugin declaration in the  
parent pom for the multi-module project:

...
     <build>
         <pluginManagement>
             <plugins>
                 <plugin>
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
                     <extensions>true</extensions>
                     <version>1.4.3</version>
                 </plugin>
...
             </plugins>
         </pluginManagement>
         <plugins>
             <plugin>
               <groupId>org.apache.felix</groupId>
               <artifactId>maven-bundle-plugin</artifactId>
             </plugin>
         </plugins>
     </build>
...

This ensures that all of the modules in the project inherit the same  
configuration and have the plugin activated.

Cheers,

-- 
Tim Moore


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle packaging conflicts with mvn release?

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/4/3 Craig L. Ching <cc...@mqsoftware.com>

> > yes, sounds like a Maven bug - are you trying to release
> > several artifacts in one go? it may be that this only occurs
> > in a multi-module release, which would square with another
> > bug (MNG-1682)
> >
>
> I'll have a look at that one, yeah, I'm doing a multi-module release.
>
> > have you tried setting the type of your dependency to be
> > bundle? ie. in the "com.mqsoftware.appwise:appwise-core" pom,
> > it would look like this:
> >
> >   <dependency>
> >     <groupId>com.mqsoftware.appwise</groupId>
> >     <artifactId>appwise-security</artifactId>
> >     <version>1.0.0.10</version>
> >     <type>bundle</type>
> >   </dependency>
> >
> > this might resolve the problem - alternatively try releasing
> > one at a time...
> >
> Yeah, I tried that but it didn't find the bundle.  I *think* it was
> looking for a .bundle extension, but I might be misremembering.
>
> > FWIW we use the bundleplugin internally at Felix and have
> > released many artifacts with "bundle" packaging, although
> > IIRC they were one at a time
> >
> I know, I steal most of my maven configuration from Felix and Sling ;-)
>
> So, if this is a bug, I'm actually thinking of using
> maven-bundle-plugin's ability to keep my jar packaging and use the jar
> plugin to add the manifest, that should work in theory, right?
>

absolutely - several Apache projects do this so they can keep their original
packaging


> > --
> > Cheers, Stuart
> >
> >
>
> Thanks Stuart, I appreciate the help.
>
> Cheers,
> Craig
>

-- 
Cheers, Stuart

RE: Bundle packaging conflicts with mvn release?

Posted by "Craig L. Ching" <cc...@mqsoftware.com>.
> yes, sounds like a Maven bug - are you trying to release 
> several artifacts in one go? it may be that this only occurs 
> in a multi-module release, which would square with another 
> bug (MNG-1682)
> 

I'll have a look at that one, yeah, I'm doing a multi-module release.

> have you tried setting the type of your dependency to be 
> bundle? ie. in the "com.mqsoftware.appwise:appwise-core" pom, 
> it would look like this:
> 
>   <dependency>
>     <groupId>com.mqsoftware.appwise</groupId>
>     <artifactId>appwise-security</artifactId>
>     <version>1.0.0.10</version>
>     <type>bundle</type>
>   </dependency>
> 
> this might resolve the problem - alternatively try releasing 
> one at a time...
> 
Yeah, I tried that but it didn't find the bundle.  I *think* it was
looking for a .bundle extension, but I might be misremembering.

> FWIW we use the bundleplugin internally at Felix and have 
> released many artifacts with "bundle" packaging, although 
> IIRC they were one at a time
> 
I know, I steal most of my maven configuration from Felix and Sling ;-)

So, if this is a bug, I'm actually thinking of using
maven-bundle-plugin's ability to keep my jar packaging and use the jar
plugin to add the manifest, that should work in theory, right?

> --
> Cheers, Stuart
> 
> 

Thanks Stuart, I appreciate the help.

Cheers,
Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle packaging conflicts with mvn release?

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/4/3 Craig L. Ching <cc...@mqsoftware.com>

> Hi all,
>
> This is probably more of a general maven question, but I'm going to
> start here in case anyone has any quick insight into what my problem
> might be.
>
> I've changed the packaging in my jars to bundle and added the OSGi
> manifests using maven-bundle-plugin in anticipation of moving our app to
> an OSGi environment.  'mvn clean install' works fine all day long,
> however, when I go to do a release with 'mvn release:prepare
> -DautoVersionSubmodules=true', I get the following:
>
> [INFO] [INFO] Failed to resolve artifact.
> [INFO]
> [INFO] Missing:
> [INFO] ----------
> [INFO] 1) com.mqsoftware.appwise:appwise-security:jar:1.0.0.10
> [INFO]
> [INFO]   Try downloading the file manually from the project website.
> [INFO]
> [INFO]   Then, install it using the command:
> [INFO]       mvn install:install-file -DgroupId=com.mqsoftware.appwise
> -DartifactId=appwise-security -Dversion=1.0.0.10 -Dpackaging=jar
> -Dfile=/path/to/file
> [INFO]
> [INFO]   Alternatively, if you host your own repository you can deploy
> the file there:
> [INFO]       mvn deploy:deploy-file -DgroupId=com.mqsoftware.appwise
> -DartifactId=appwise-security -Dversion=1.0.0.10 -Dpackaging=jar
> -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
> [INFO]
> [INFO]   Path to dependency:
> [INFO]          1) com.mqsoftware.appwise:appwise-core:bundle:1.0.0.10
> [INFO]          2) com.mqsoftware.appwise:appwise-security:jar:1.0.0.10
> [INFO]
> [INFO] ----------
> [INFO] 1 required artifact is missing.
> [INFO]
> [INFO] for artifact:
> [INFO]   com.mqsoftware.appwise:appwise-core:bundle:1.0.0.10
> [INFO]
> [INFO] from the specified remote repositories:
> [INFO]   central (http://repo1.maven.org/maven2),
> [INFO]   cerberus-snapshots (http://cerberus:8081/artifactory/repo),
> [INFO]   cerberus-central (http://cerberus:8081/artifactory/repo)
>
> (appwise-security and appwise-core are both bundles, this happens when
> we're building appwise-core which depends on appwise-security.)
>
> This only happens with the bundle packaging, changing the packaging back
> to jar (by removing the <packaging></packaging> elements altogether)
> makes mvn release work.
>
> So, the reason I say it's probably a general maven issue and a
> misunderstanding on my part is because it's looking at remote
> repositories instead of in my workspace and I don't understand why.  But
> the reason I'm asking here is because it happens when I use
> '<packaging>bundle</packaging>' and I'm hoping I get a better/quicker
> answer here ;-)
>

yes, sounds like a Maven bug - are you trying to release several artifacts
in one go? it may be that this only occurs in a multi-module release, which
would square with another bug (MNG-1682)

have you tried setting the type of your dependency to be bundle? ie. in
the "com.mqsoftware.appwise:appwise-core" pom, it would look like this:

  <dependency>
    <groupId>com.mqsoftware.appwise</groupId>
    <artifactId>appwise-security</artifactId>
    <version>1.0.0.10</version>
    <type>bundle</type>
  </dependency>

this might resolve the problem - alternatively try releasing one at a
time...

FWIW we use the bundleplugin internally at Felix and have released many
artifacts with "bundle" packaging, although IIRC they were one at a time


> Thanks for any help!
>
> Cheers,
> Craig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

-- 
Cheers, Stuart