You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Arash Amiri <ar...@researchstudio.at> on 2007/08/03 15:00:33 UTC

adding external jars to bundle

ok, below is my pom.xml
here is what I did:
- added commons-httpclient.jar to the classpath (as an environment-variable)
- called "mvn clean package"
- started the equinox-platform (java -jar equinox.jar -console)
- installed the bundle
- start the bundle --> ERROR: Missing Constraint: commons-httpclient

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TestOsgi</groupId>
<artifactId>TestOsgi</artifactId>
<packaging>bundle</packaging>
<name>TestOsgi</name>
<version>1.0</version>
<url>http://maven.apache.org</url>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.apache.commons.httpclient.methods.*</Export-Package>
<Export-Package>at.osgi</Export-Package>
<Bundle-Activator>at.osgi.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>apache.m2.incubator</id>
<name>Apache M2 Incubator Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.m2.incubator</id>
<name>Apache M2 Incubator Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi_R4_core</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>0.8.0-incubator</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1-beta1</version>
</dependency>
</dependencies>
</project>


-- 
DI Arash Amiri
Junior Researcher

Research Studios Austria - Digital Memory Engineering
Austrian Research Centers GmbH

Thurngasse 8/20, A-1090 Wien
T +43-1-585 0537-19
F +43-1-585 3741
M +43-664-825 1276
HG Wien – FN 115980i – ATU14703506

http://dme.researchstudio.at
http://www.researchstudio.at


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


Re: adding external jars to bundle

Posted by Craig Ching <cr...@gmail.com>.
Whoops, I completely missed that he had two <Export-Package> stanzas!

On 8/3/07, Stuart McCulloch <st...@jayway.net> wrote:
>
> On 03/08/07, Arash Amiri <ar...@researchstudio.at> wrote:
> > ok, below is my pom.xml
> > here is what I did:
> > - added commons-httpclient.jar to the classpath (as an
> environment-variable)
> > - called "mvn clean package"
> > - started the equinox-platform (java -jar equinox.jar -console)
> > - installed the bundle
> > - start the bundle --> ERROR: Missing Constraint: commons-httpclient
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <groupId>TestOsgi</groupId>
> > <artifactId>TestOsgi</artifactId>
> > <packaging>bundle</packaging>
> > <name>TestOsgi</name>
> > <version>1.0</version>
> > <url>http://maven.apache.org</url>
> > <build>
> > <pluginManagement>
> > <plugins>
> > <plugin>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <inherited>true</inherited>
> > <configuration>
> > <source>1.5</source>
> > <target>1.5</target>
> > </configuration>
> > </plugin>
> > </plugins>
> > </pluginManagement>
> > <plugins>
> > <plugin>
> > <groupId>org.apache.felix</groupId>
> > <artifactId>maven-bundle-plugin</artifactId>
> > <extensions>true</extensions>
> > <configuration>
> > <instructions>
> > <Export-Package>org.apache.commons.httpclient.methods.*</Export-Package>
> > <Export-Package>at.osgi</Export-Package>
>
> ^I think this is the problem - by setting two <Export-Package> stanzas
>   the second definition is overwriting the first, so the bundle-plugin
> will
>   only get the second one (ie. "at.osgi")
>
> Export-Package (as described at http://www.aqute.biz/Code/Bnd)
> expects a comma separated list of packages, so try something like:
>
>    <Export-Package>org.apache.commons.httpclient.methods.*,at.osgi
> </Export-Package>
>
> > <Bundle-Activator>at.osgi.Activator</Bundle-Activator>
> > </instructions>
> > </configuration>
> > </plugin>
> > </plugins>
> > </build>
> > <repositories>
> > <repository>
> > <id>apache.m2.incubator</id>
> > <name>Apache M2 Incubator Repository</name>
> > <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> > </repository>
> > </repositories>
> > <pluginRepositories>
> > <pluginRepository>
> > <id>apache.m2.incubator</id>
> > <name>Apache M2 Incubator Repository</name>
> > <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> > </pluginRepository>
> > </pluginRepositories>
> > <dependencies>
> > <dependency>
> > <groupId>junit</groupId>
> > <artifactId>junit</artifactId>
> > <version>3.8.1</version>
> > <scope>test</scope>
> > </dependency>
> > <dependency>
> > <groupId>org.osgi</groupId>
> > <artifactId>osgi_R4_core</artifactId>
> > <version>1.0</version>
> > </dependency>
> > <dependency>
> > <groupId>org.apache.felix</groupId>
> > <artifactId>org.osgi.core</artifactId>
> > <version>0.8.0-incubator</version>
> > </dependency>
> > <dependency>
> > <groupId>commons-httpclient</groupId>
> > <artifactId>commons-httpclient</artifactId>
> > <version>3.1-beta1</version>
> > </dependency>
> > </dependencies>
> > </project>
> >
> >
> > --
> > DI Arash Amiri
> > Junior Researcher
> >
> > Research Studios Austria - Digital Memory Engineering
> > Austrian Research Centers GmbH
> >
> > Thurngasse 8/20, A-1090 Wien
> > T +43-1-585 0537-19
> > F +43-1-585 3741
> > M +43-664-825 1276
> > HG Wien – FN 115980i – ATU14703506
> >
> > http://dme.researchstudio.at
> > http://www.researchstudio.at
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Cheers, Stuart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: adding external jars to bundle

Posted by Stuart McCulloch <st...@jayway.net>.
On 03/08/07, Arash Amiri <ar...@researchstudio.at> wrote:
> ok, below is my pom.xml
> here is what I did:
> - added commons-httpclient.jar to the classpath (as an environment-variable)
> - called "mvn clean package"
> - started the equinox-platform (java -jar equinox.jar -console)
> - installed the bundle
> - start the bundle --> ERROR: Missing Constraint: commons-httpclient
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>TestOsgi</groupId>
> <artifactId>TestOsgi</artifactId>
> <packaging>bundle</packaging>
> <name>TestOsgi</name>
> <version>1.0</version>
> <url>http://maven.apache.org</url>
> <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <inherited>true</inherited>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>org.apache.commons.httpclient.methods.*</Export-Package>
> <Export-Package>at.osgi</Export-Package>

^I think this is the problem - by setting two <Export-Package> stanzas
  the second definition is overwriting the first, so the bundle-plugin will
  only get the second one (ie. "at.osgi")

Export-Package (as described at http://www.aqute.biz/Code/Bnd)
expects a comma separated list of packages, so try something like:

   <Export-Package>org.apache.commons.httpclient.methods.*,at.osgi</Export-Package>

> <Bundle-Activator>at.osgi.Activator</Bundle-Activator>
> </instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
> <repositories>
> <repository>
> <id>apache.m2.incubator</id>
> <name>Apache M2 Incubator Repository</name>
> <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> </repository>
> </repositories>
> <pluginRepositories>
> <pluginRepository>
> <id>apache.m2.incubator</id>
> <name>Apache M2 Incubator Repository</name>
> <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> </pluginRepository>
> </pluginRepositories>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>org.osgi</groupId>
> <artifactId>osgi_R4_core</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.osgi.core</artifactId>
> <version>0.8.0-incubator</version>
> </dependency>
> <dependency>
> <groupId>commons-httpclient</groupId>
> <artifactId>commons-httpclient</artifactId>
> <version>3.1-beta1</version>
> </dependency>
> </dependencies>
> </project>
>
>
> --
> DI Arash Amiri
> Junior Researcher
>
> Research Studios Austria - Digital Memory Engineering
> Austrian Research Centers GmbH
>
> Thurngasse 8/20, A-1090 Wien
> T +43-1-585 0537-19
> F +43-1-585 3741
> M +43-664-825 1276
> HG Wien – FN 115980i – ATU14703506
>
> http://dme.researchstudio.at
> http://www.researchstudio.at
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Cheers, Stuart

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


Re: adding external jars to bundle

Posted by Stuart McCulloch <st...@jayway.net>.
On 03/08/07, Craig Ching <cr...@gmail.com> wrote:
> Hi Arash,
>
> A few suggestions for you:
>
> 1)  In your Export-Package statement, you're exporting
> org.apache.commons.httpclient.methods.*.  You might also want to add that to
> your Import-Package as well, it's recommended practice (read the core spec
> about why, you might have reasons for not wanting to do that, but if you
> don't  have those reasons, then take the advice in the spec).  Doing this
> might also give you some insight into what you're missing during the bundle
> process.

fyi, the BND tool (used by the bundle plugin) automatically adds import
metadata for any exported packages. The default Import-Package is *,
which is what most bundles should use - ie. any non "java.*" packages
used by the bundle, but not contained inside it, will be imported.

the contents of a bundle are calculated using:

   Private-Package:    list of packages (not exported or imported)
   Export-Package:     list of packages (exported and imported)
   Include-Resource:  list of resources / jars

and any non-private packages are imported (unless you override this
by setting Import-Package to something different - see the Bnd page
at http://www.aqute.biz/Code/Bnd)

>
> 2)  Since you're using equinox, you can use the diag command.  Use diag
> <bundle id>, it might give you some good information.
>
> 3)  Post your MANIFEST.MF
>
> 4)  This is getting beyond maven, you might find better help on the Felix
> mailing lists (where the maven-bundle-plugin is maintained) or on the
> equinox mailing list/newsgroup.
>
> Cheers,
> Craig
>
> On 8/3/07, Arash Amiri <ar...@researchstudio.at> wrote:
> >
> > ok, below is my pom.xml
> > here is what I did:
> > - added commons-httpclient.jar to the classpath (as an
> > environment-variable)
> > - called "mvn clean package"
> > - started the equinox-platform (java -jar equinox.jar -console)
> > - installed the bundle
> > - start the bundle --> ERROR: Missing Constraint: commons-httpclient
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> > <groupId>TestOsgi</groupId>
> > <artifactId>TestOsgi</artifactId>
> > <packaging>bundle</packaging>
> > <name>TestOsgi</name>
> > <version>1.0</version>
> > <url>http://maven.apache.org</url>
> > <build>
> > <pluginManagement>
> > <plugins>
> > <plugin>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <inherited>true</inherited>
> > <configuration>
> > <source>1.5</source>
> > <target>1.5</target>
> > </configuration>
> > </plugin>
> > </plugins>
> > </pluginManagement>
> > <plugins>
> > <plugin>
> > <groupId>org.apache.felix</groupId>
> > <artifactId>maven-bundle-plugin</artifactId>
> > <extensions>true</extensions>
> > <configuration>
> > <instructions>
> > <Export-Package>org.apache.commons.httpclient.methods.*</Export-Package>
> > <Export-Package>at.osgi</Export-Package>
> > <Bundle-Activator>at.osgi.Activator</Bundle-Activator>
> > </instructions>
> > </configuration>
> > </plugin>
> > </plugins>
> > </build>
> > <repositories>
> > <repository>
> > <id>apache.m2.incubator</id>
> > <name>Apache M2 Incubator Repository</name>
> > <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> > </repository>
> > </repositories>
> > <pluginRepositories>
> > <pluginRepository>
> > <id>apache.m2.incubator</id>
> > <name>Apache M2 Incubator Repository</name>
> > <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> > </pluginRepository>
> > </pluginRepositories>
> > <dependencies>
> > <dependency>
> > <groupId>junit</groupId>
> > <artifactId>junit</artifactId>
> > <version>3.8.1</version>
> > <scope>test</scope>
> > </dependency>
> > <dependency>
> > <groupId>org.osgi</groupId>
> > <artifactId>osgi_R4_core</artifactId>
> > <version>1.0</version>
> > </dependency>
> > <dependency>
> > <groupId>org.apache.felix</groupId>
> > <artifactId>org.osgi.core</artifactId>
> > <version>0.8.0-incubator</version>
> > </dependency>
> > <dependency>
> > <groupId>commons-httpclient</groupId>
> > <artifactId>commons-httpclient</artifactId>
> > <version>3.1-beta1</version>
> > </dependency>
> > </dependencies>
> > </project>
> >
> >
> > --
> > DI Arash Amiri
> > Junior Researcher
> >
> > Research Studios Austria - Digital Memory Engineering
> > Austrian Research Centers GmbH
> >
> > Thurngasse 8/20, A-1090 Wien
> > T +43-1-585 0537-19
> > F +43-1-585 3741
> > M +43-664-825 1276
> > HG Wien – FN 115980i – ATU14703506
> >
> > http://dme.researchstudio.at
> > http://www.researchstudio.at
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>


-- 
Cheers, Stuart

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


Re: adding external jars to bundle

Posted by Craig Ching <cr...@gmail.com>.
Hi Arash,

A few suggestions for you:

1)  In your Export-Package statement, you're exporting
org.apache.commons.httpclient.methods.*.  You might also want to add that to
your Import-Package as well, it's recommended practice (read the core spec
about why, you might have reasons for not wanting to do that, but if you
don't  have those reasons, then take the advice in the spec).  Doing this
might also give you some insight into what you're missing during the bundle
process.

2)  Since you're using equinox, you can use the diag command.  Use diag
<bundle id>, it might give you some good information.

3)  Post your MANIFEST.MF

4)  This is getting beyond maven, you might find better help on the Felix
mailing lists (where the maven-bundle-plugin is maintained) or on the
equinox mailing list/newsgroup.

Cheers,
Craig

On 8/3/07, Arash Amiri <ar...@researchstudio.at> wrote:
>
> ok, below is my pom.xml
> here is what I did:
> - added commons-httpclient.jar to the classpath (as an
> environment-variable)
> - called "mvn clean package"
> - started the equinox-platform (java -jar equinox.jar -console)
> - installed the bundle
> - start the bundle --> ERROR: Missing Constraint: commons-httpclient
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>TestOsgi</groupId>
> <artifactId>TestOsgi</artifactId>
> <packaging>bundle</packaging>
> <name>TestOsgi</name>
> <version>1.0</version>
> <url>http://maven.apache.org</url>
> <build>
> <pluginManagement>
> <plugins>
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <inherited>true</inherited>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </plugin>
> </plugins>
> </pluginManagement>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>org.apache.commons.httpclient.methods.*</Export-Package>
> <Export-Package>at.osgi</Export-Package>
> <Bundle-Activator>at.osgi.Activator</Bundle-Activator>
> </instructions>
> </configuration>
> </plugin>
> </plugins>
> </build>
> <repositories>
> <repository>
> <id>apache.m2.incubator</id>
> <name>Apache M2 Incubator Repository</name>
> <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> </repository>
> </repositories>
> <pluginRepositories>
> <pluginRepository>
> <id>apache.m2.incubator</id>
> <name>Apache M2 Incubator Repository</name>
> <url>http://people.apache.org/repo/m2-incubating-repository/</url>
> </pluginRepository>
> </pluginRepositories>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>org.osgi</groupId>
> <artifactId>osgi_R4_core</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.osgi.core</artifactId>
> <version>0.8.0-incubator</version>
> </dependency>
> <dependency>
> <groupId>commons-httpclient</groupId>
> <artifactId>commons-httpclient</artifactId>
> <version>3.1-beta1</version>
> </dependency>
> </dependencies>
> </project>
>
>
> --
> DI Arash Amiri
> Junior Researcher
>
> Research Studios Austria - Digital Memory Engineering
> Austrian Research Centers GmbH
>
> Thurngasse 8/20, A-1090 Wien
> T +43-1-585 0537-19
> F +43-1-585 3741
> M +43-664-825 1276
> HG Wien – FN 115980i – ATU14703506
>
> http://dme.researchstudio.at
> http://www.researchstudio.at
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>