You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2009/11/15 06:05:23 UTC

Geronimo 3.0: verifying generated manifests

Hey,

I added a small plugin that verifies the generated manifest against
the dependencies (bundles). It uses the eclipse API to validate the
manifest so it's following the OSGi rules. Hopefully, this should help
us detect problems sooner at build time. For example, it catches a
problem where the code uses some class from non-exported package. The
complication would be successful but at runtime you would see
resolution problems.

Right now the plugin is only enabled for modules in framework but we
could enable it for all plugins. Also, any problems are reported as
warnings (so it doesn't break the build).

Also, the plugin contains display-manifest goal that displays import
and export packages in the manifest. I just got tired of reading the
manifest file in emacs (yes, i know I could open it in IDE too). To
display the import/export packages run the following (once the code is
compiled and the manifest files are generated):

mvn org.apache.geronimo.buildsupport:geronimo-osgi-plugin:display-manifest

Btw, the plugin borrows a bunch of code from the Tuscany Maven Eclipse
Compiler module. And I might eventually donate this plugin back to
Tuscany.

Side note: The Eclipse JDT compiler supports specifying "access rules"
on each classpath component. With these access rules you can specify
which classes or packages the compiler can see. The Export-Package
header in manifest of the dependencies could be translated into the
right set of access rules. With that in place we could catch the
package visibility issues right at compile time. The
plexus-compiler-eclipse and Tuscany's maven-eclipse-compiler compiler
plugins for maven-compiler-plugin do not support access rules. The
tycho-compiler-jdt compiler plugin has some support for it but they
are not automatically derived from the dependencies - must be passed
explicitly. Tycho's maven-osgi-compiler-plugin has support for access
rules but requires Maven 3.0 and I think it needs Eclipse specific
build files. Anyway, maybe this is something we want to look into in
the future. For now the manifest checking should be good enough.

Jarek

Re: Geronimo 3.0: verifying generated manifests

Posted by David Jencks <da...@yahoo.com>.
very cool!

FWIW, I have no object to requiring maven 3 for trunk as long as we  
can get the build to work more or less as well as it does now.  If  
that helps with osgi-maven tooling I'd say the sooner the better.

thanks
david jencks

On Nov 14, 2009, at 9:05 PM, Jarek Gawor wrote:

> Hey,
>
> I added a small plugin that verifies the generated manifest against
> the dependencies (bundles). It uses the eclipse API to validate the
> manifest so it's following the OSGi rules. Hopefully, this should help
> us detect problems sooner at build time. For example, it catches a
> problem where the code uses some class from non-exported package. The
> complication would be successful but at runtime you would see
> resolution problems.
>
> Right now the plugin is only enabled for modules in framework but we
> could enable it for all plugins. Also, any problems are reported as
> warnings (so it doesn't break the build).
>
> Also, the plugin contains display-manifest goal that displays import
> and export packages in the manifest. I just got tired of reading the
> manifest file in emacs (yes, i know I could open it in IDE too). To
> display the import/export packages run the following (once the code is
> compiled and the manifest files are generated):
>
> mvn org.apache.geronimo.buildsupport:geronimo-osgi-plugin:display- 
> manifest
>
> Btw, the plugin borrows a bunch of code from the Tuscany Maven Eclipse
> Compiler module. And I might eventually donate this plugin back to
> Tuscany.
>
> Side note: The Eclipse JDT compiler supports specifying "access rules"
> on each classpath component. With these access rules you can specify
> which classes or packages the compiler can see. The Export-Package
> header in manifest of the dependencies could be translated into the
> right set of access rules. With that in place we could catch the
> package visibility issues right at compile time. The
> plexus-compiler-eclipse and Tuscany's maven-eclipse-compiler compiler
> plugins for maven-compiler-plugin do not support access rules. The
> tycho-compiler-jdt compiler plugin has some support for it but they
> are not automatically derived from the dependencies - must be passed
> explicitly. Tycho's maven-osgi-compiler-plugin has support for access
> rules but requires Maven 3.0 and I think it needs Eclipse specific
> build files. Anyway, maybe this is something we want to look into in
> the future. For now the manifest checking should be good enough.
>
> Jarek


Re: Geronimo 3.0: verifying generated manifests

Posted by Rick McGuire <ri...@gmail.com>.
Rick McGuire wrote:
> I'm having problems building this because of missing dependencies now 
> when trying to build.  Interestingly, I get a missting dependency for 
> geronimo-osgi-plugin while attempting to build geronimo-osgi-plugin.  
> It looks like there is a little bootstrapping problem here.
> Where can I find the rest of the dependencies (such as maven-project)?
Oops, forgot to paste in the error information.

 Connection timed out: connect
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.apache.maven:maven-project:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-pro
ject -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-proje
ct -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-Drepository
Id=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8

2) org.apache.maven:maven-settings:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-set
tings -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-setti
ngs -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-Drepositor
yId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-settings:jar:2.0.8

3) org.apache.maven:maven-model:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-mod
el -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-model
 -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-DrepositoryId
=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-model:jar:2.0.8

4) org.apache.maven:maven-profile:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-pro
file -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-profi
le -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-Drepository
Id=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-profile:jar:2.0.8

5) org.apache.maven:maven-artifact-manager:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-art
ifact-manager -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-artif
act-manager -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file 
-Durl=[url] -Dr
epositoryId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-artifact-manager:jar:2.0.8

6) org.apache.maven:maven-repository-metadata:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-rep
ository-metadata -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-repos
itory-metadata -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file 
-Durl=[url]
-DrepositoryId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-artifact-manager:jar:2.0.8
        4) org.apache.maven:maven-repository-metadata:jar:2.0.8

7) org.apache.maven:maven-artifact:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-art
ifact -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-artif
act -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-Drepositor
yId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-artifact:jar:2.0.8

8) org.apache.maven:maven-plugin-registry:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-plu
gin-registry -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-plugi
n-registry -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file 
-Durl=[url] -Dre
positoryId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-project:jar:2.0.8
        3) org.apache.maven:maven-plugin-registry:jar:2.0.8

9) org.apache.maven:maven-plugin-api:jar:2.0.8

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven 
-DartifactId=maven-plu
gin-api -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file 
there:

      mvn deploy:deploy-file -DgroupId=org.apache.maven 
-DartifactId=maven-plugi
n-api -Dversion=2.0.8 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] 
-Dreposit
oryId=[id]

  Path to dependency:
        1) 
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.
0-SNAPSHOT
        2) org.apache.maven:maven-plugin-api:jar:2.0.8

----------
9 required artifacts are missing.

for artifact:
  
org.apache.geronimo.buildsupport:geronimo-osgi-plugin:maven-plugin:3.0-SNAPSHO
T

from the specified remote repositories:
  apache.snapshots (http://repository.apache.org/snapshots),
  codehaus.snapshots (http://snapshots.repository.codehaus.org),
  tuscany.repo (http://svn.apache.org/repos/asf/tuscany/maven),
  repo.mergere.com (http://repo.mergere.com/maven2)



>
> Rick
>
> Jarek Gawor wrote:
>> Hey,
>>
>> I added a small plugin that verifies the generated manifest against
>> the dependencies (bundles). It uses the eclipse API to validate the
>> manifest so it's following the OSGi rules. Hopefully, this should help
>> us detect problems sooner at build time. For example, it catches a
>> problem where the code uses some class from non-exported package. The
>> complication would be successful but at runtime you would see
>> resolution problems.
>>
>> Right now the plugin is only enabled for modules in framework but we
>> could enable it for all plugins. Also, any problems are reported as
>> warnings (so it doesn't break the build).
>>
>> Also, the plugin contains display-manifest goal that displays import
>> and export packages in the manifest. I just got tired of reading the
>> manifest file in emacs (yes, i know I could open it in IDE too). To
>> display the import/export packages run the following (once the code is
>> compiled and the manifest files are generated):
>>
>> mvn 
>> org.apache.geronimo.buildsupport:geronimo-osgi-plugin:display-manifest
>>
>> Btw, the plugin borrows a bunch of code from the Tuscany Maven Eclipse
>> Compiler module. And I might eventually donate this plugin back to
>> Tuscany.
>>
>> Side note: The Eclipse JDT compiler supports specifying "access rules"
>> on each classpath component. With these access rules you can specify
>> which classes or packages the compiler can see. The Export-Package
>> header in manifest of the dependencies could be translated into the
>> right set of access rules. With that in place we could catch the
>> package visibility issues right at compile time. The
>> plexus-compiler-eclipse and Tuscany's maven-eclipse-compiler compiler
>> plugins for maven-compiler-plugin do not support access rules. The
>> tycho-compiler-jdt compiler plugin has some support for it but they
>> are not automatically derived from the dependencies - must be passed
>> explicitly. Tycho's maven-osgi-compiler-plugin has support for access
>> rules but requires Maven 3.0 and I think it needs Eclipse specific
>> build files. Anyway, maybe this is something we want to look into in
>> the future. For now the manifest checking should be good enough.
>>
>> Jarek
>>
>>   
>
>


Re: Geronimo 3.0: verifying generated manifests

Posted by Rick McGuire <ri...@gmail.com>.
I'm having problems building this because of missing dependencies now 
when trying to build.  Interestingly, I get a missting dependency for 
geronimo-osgi-plugin while attempting to build geronimo-osgi-plugin.  It 
looks like there is a little bootstrapping problem here. 

Where can I find the rest of the dependencies (such as maven-project)?

Rick

Jarek Gawor wrote:
> Hey,
>
> I added a small plugin that verifies the generated manifest against
> the dependencies (bundles). It uses the eclipse API to validate the
> manifest so it's following the OSGi rules. Hopefully, this should help
> us detect problems sooner at build time. For example, it catches a
> problem where the code uses some class from non-exported package. The
> complication would be successful but at runtime you would see
> resolution problems.
>
> Right now the plugin is only enabled for modules in framework but we
> could enable it for all plugins. Also, any problems are reported as
> warnings (so it doesn't break the build).
>
> Also, the plugin contains display-manifest goal that displays import
> and export packages in the manifest. I just got tired of reading the
> manifest file in emacs (yes, i know I could open it in IDE too). To
> display the import/export packages run the following (once the code is
> compiled and the manifest files are generated):
>
> mvn org.apache.geronimo.buildsupport:geronimo-osgi-plugin:display-manifest
>
> Btw, the plugin borrows a bunch of code from the Tuscany Maven Eclipse
> Compiler module. And I might eventually donate this plugin back to
> Tuscany.
>
> Side note: The Eclipse JDT compiler supports specifying "access rules"
> on each classpath component. With these access rules you can specify
> which classes or packages the compiler can see. The Export-Package
> header in manifest of the dependencies could be translated into the
> right set of access rules. With that in place we could catch the
> package visibility issues right at compile time. The
> plexus-compiler-eclipse and Tuscany's maven-eclipse-compiler compiler
> plugins for maven-compiler-plugin do not support access rules. The
> tycho-compiler-jdt compiler plugin has some support for it but they
> are not automatically derived from the dependencies - must be passed
> explicitly. Tycho's maven-osgi-compiler-plugin has support for access
> rules but requires Maven 3.0 and I think it needs Eclipse specific
> build files. Anyway, maybe this is something we want to look into in
> the future. For now the manifest checking should be good enough.
>
> Jarek
>
>