You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Clay McCoy <cm...@claymccoy.com> on 2011/01/10 23:53:48 UTC

Embed-Dependency - where are my jars?

Embed-Dependency is simply not adding any dependent jars to the final jar.
 I specifically expected the guava jar to be in the resulting jar.  I must
be missing something fundamental here.  Below is my pom, and then the output
from a maven clean install.  Note, I am using Maven 3.0.1.
Thanks,
Clay

<?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>com.jha.yhs</groupId>
  <artifactId>pomfirst-bundle</artifactId>
  <version>0.1.0-SNAPSHOT</version>

  <dependencies>
   <dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>r07</version>
</dependency>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.2</version>
      <scope>test</scope>
      </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
              <source>1.6</source>
              <target>1.6</target>
          </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.1.0</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <manifestLocation>META-INF</manifestLocation>
    <instructions>
  <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
</instructions>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>


$ mvn clean install
Switching to ParallelGC to avoid CMS/CompressedOops incompatibility
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building Unnamed - com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT
[INFO]    task-segment: [clean, install]
[INFO]
------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/classes
[INFO] [bundle:manifest {execution: bundle-manifest}]
[WARNING] Warning in manifest for
com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : No sub JAR or directory
guava-r07.jar
[WARNING] Warning in manifest for
com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : Superfluous export-package
instructions: [com, com.jha.yhs, com.jha]
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory:
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.jha.yhs.pomfirst.PomFirstTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.1 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar:
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
[INFO] [install:install {execution: default-install}]
[INFO] Installing
/Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
to
/Users/crowmobe/.m2/repository/com/jha/yhs/pomfirst-bundle/0.1.0-SNAPSHOT/pomfirst-bundle-0.1.0-SNAPSHOT.jar
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Mon Jan 10 16:51:16 CST 2011
[INFO] Final Memory: 24M/246M
[INFO]
------------------------------------------------------------------------

Re: Embed-Dependency - where are my jars?

Posted by Clay McCoy <cm...@claymccoy.com>.
Thanks, this put the jars in place.

On Mon, Jan 10, 2011 at 5:04 PM, Stuart McCulloch <mc...@gmail.com> wrote:

> On 10 January 2011 22:53, Clay McCoy <cm...@claymccoy.com> wrote:
>
> > Embed-Dependency is simply not adding any dependent jars to the final
> jar.
> >  I specifically expected the guava jar to be in the resulting jar.  I
> must
> > be missing something fundamental here.
>
>
> The pom below only asks the maven-bundle-plugin to create a manifest:
>
>   <goal>manifest</goal>
>
> So it won't be adding anything to the jar, since it's not actually creating
> it.
> Instead this pom still uses the default packaging of "jar", so the jar will
> be
> created by the maven-jar-plugin - which is what the log below also shows.
>
> If you want the maven-bundle-plugin to create the jar then you'll need to
> change the pom packaging to be "bundle" as per the examples found at:
>
>   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
>
> HTH
>
>  Below is my pom, and then the output
> > from a maven clean install.  Note, I am using Maven 3.0.1.
> > Thanks,
> > Clay
> >
> > <?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>com.jha.yhs</groupId>
> >  <artifactId>pomfirst-bundle</artifactId>
> >  <version>0.1.0-SNAPSHOT</version>
> >
> >  <dependencies>
> >   <dependency>
> >    <groupId>com.google.guava</groupId>
> >    <artifactId>guava</artifactId>
> >    <version>r07</version>
> > </dependency>
> >      <dependency>
> >          <groupId>junit</groupId>
> >          <artifactId>junit</artifactId>
> >          <version>4.8.2</version>
> >      <scope>test</scope>
> >      </dependency>
> >  </dependencies>
> >
> >  <build>
> >    <plugins>
> >      <plugin>
> >          <groupId>org.apache.maven.plugins</groupId>
> >          <artifactId>maven-compiler-plugin</artifactId>
> >          <version>2.0.2</version>
> >          <configuration>
> >              <source>1.6</source>
> >              <target>1.6</target>
> >          </configuration>
> >      </plugin>
> >
> >      <plugin>
> >        <groupId>org.apache.felix</groupId>
> >        <artifactId>maven-bundle-plugin</artifactId>
> >        <version>2.1.0</version>
> >        <executions>
> >          <execution>
> >            <id>bundle-manifest</id>
> >            <phase>process-classes</phase>
> >            <goals>
> >              <goal>manifest</goal>
> >            </goals>
> >          </execution>
> >        </executions>
> >        <configuration>
> >          <manifestLocation>META-INF</manifestLocation>
> >    <instructions>
> >  <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
> > </instructions>
> >        </configuration>
> >      </plugin>
> >
> >    </plugins>
> >  </build>
> >
> > </project>
> >
> >
> > $ mvn clean install
> > Switching to ParallelGC to avoid CMS/CompressedOops incompatibility
> > [INFO] Scanning for projects...
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Building Unnamed - com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT
> > [INFO]    task-segment: [clean, install]
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] [clean:clean {execution: default-clean}]
> > [INFO] Deleting directory
> > /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target
> > [INFO] [resources:resources {execution: default-resources}]
> > [WARNING] Using platform encoding (MacRoman actually) to copy filtered
> > resources, i.e. build is platform dependent!
> > [INFO] skip non existing resourceDirectory
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/main/resources
> > [INFO] [compiler:compile {execution: default-compile}]
> > [INFO] Compiling 1 source file to
> > /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/classes
> > [INFO] [bundle:manifest {execution: bundle-manifest}]
> > [WARNING] Warning in manifest for
> > com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : No sub JAR or directory
> > guava-r07.jar
> > [WARNING] Warning in manifest for
> > com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : Superfluous
> export-package
> > instructions: [com, com.jha.yhs, com.jha]
> > [INFO] [resources:testResources {execution: default-testResources}]
> > [WARNING] Using platform encoding (MacRoman actually) to copy filtered
> > resources, i.e. build is platform dependent!
> > [INFO] skip non existing resourceDirectory
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/test/resources
> > [INFO] [compiler:testCompile {execution: default-testCompile}]
> > [INFO] Compiling 1 source file to
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/test-classes
> > [INFO] [surefire:test {execution: default-test}]
> > [INFO] Surefire report directory:
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/surefire-reports
> >
> > -------------------------------------------------------
> >  T E S T S
> > -------------------------------------------------------
> > Running com.jha.yhs.pomfirst.PomFirstTest
> > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.1 sec
> >
> > Results :
> >
> > Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> >
> > [INFO] [jar:jar {execution: default-jar}]
> > [INFO] Building jar:
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> > [INFO] [install:install {execution: default-install}]
> > [INFO] Installing
> >
> >
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> > to
> >
> >
> /Users/crowmobe/.m2/repository/com/jha/yhs/pomfirst-bundle/0.1.0-SNAPSHOT/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] BUILD SUCCESSFUL
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 6 seconds
> > [INFO] Finished at: Mon Jan 10 16:51:16 CST 2011
> > [INFO] Final Memory: 24M/246M
> > [INFO]
> > ------------------------------------------------------------------------
> >
>
>
>
> --
> Cheers, Stuart
>

Re: Embed-Dependency - where are my jars?

Posted by Stuart McCulloch <mc...@gmail.com>.
On 10 January 2011 22:53, Clay McCoy <cm...@claymccoy.com> wrote:

> Embed-Dependency is simply not adding any dependent jars to the final jar.
>  I specifically expected the guava jar to be in the resulting jar.  I must
> be missing something fundamental here.


The pom below only asks the maven-bundle-plugin to create a manifest:

   <goal>manifest</goal>

So it won't be adding anything to the jar, since it's not actually creating
it.
Instead this pom still uses the default packaging of "jar", so the jar will
be
created by the maven-jar-plugin - which is what the log below also shows.

If you want the maven-bundle-plugin to create the jar then you'll need to
change the pom packaging to be "bundle" as per the examples found at:

   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

HTH

 Below is my pom, and then the output
> from a maven clean install.  Note, I am using Maven 3.0.1.
> Thanks,
> Clay
>
> <?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>com.jha.yhs</groupId>
>  <artifactId>pomfirst-bundle</artifactId>
>  <version>0.1.0-SNAPSHOT</version>
>
>  <dependencies>
>   <dependency>
>    <groupId>com.google.guava</groupId>
>    <artifactId>guava</artifactId>
>    <version>r07</version>
> </dependency>
>      <dependency>
>          <groupId>junit</groupId>
>          <artifactId>junit</artifactId>
>          <version>4.8.2</version>
>      <scope>test</scope>
>      </dependency>
>  </dependencies>
>
>  <build>
>    <plugins>
>      <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-compiler-plugin</artifactId>
>          <version>2.0.2</version>
>          <configuration>
>              <source>1.6</source>
>              <target>1.6</target>
>          </configuration>
>      </plugin>
>
>      <plugin>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>maven-bundle-plugin</artifactId>
>        <version>2.1.0</version>
>        <executions>
>          <execution>
>            <id>bundle-manifest</id>
>            <phase>process-classes</phase>
>            <goals>
>              <goal>manifest</goal>
>            </goals>
>          </execution>
>        </executions>
>        <configuration>
>          <manifestLocation>META-INF</manifestLocation>
>    <instructions>
>  <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
> </instructions>
>        </configuration>
>      </plugin>
>
>    </plugins>
>  </build>
>
> </project>
>
>
> $ mvn clean install
> Switching to ParallelGC to avoid CMS/CompressedOops incompatibility
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Unnamed - com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT
> [INFO]    task-segment: [clean, install]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [clean:clean {execution: default-clean}]
> [INFO] Deleting directory
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target
> [INFO] [resources:resources {execution: default-resources}]
> [WARNING] Using platform encoding (MacRoman actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/main/resources
> [INFO] [compiler:compile {execution: default-compile}]
> [INFO] Compiling 1 source file to
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/classes
> [INFO] [bundle:manifest {execution: bundle-manifest}]
> [WARNING] Warning in manifest for
> com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : No sub JAR or directory
> guava-r07.jar
> [WARNING] Warning in manifest for
> com.jha.yhs:pomfirst-bundle:jar:0.1.0-SNAPSHOT : Superfluous export-package
> instructions: [com, com.jha.yhs, com.jha]
> [INFO] [resources:testResources {execution: default-testResources}]
> [WARNING] Using platform encoding (MacRoman actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/src/test/resources
> [INFO] [compiler:testCompile {execution: default-testCompile}]
> [INFO] Compiling 1 source file to
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/test-classes
> [INFO] [surefire:test {execution: default-test}]
> [INFO] Surefire report directory:
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/surefire-reports
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running com.jha.yhs.pomfirst.PomFirstTest
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.1 sec
>
> Results :
>
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO] [jar:jar {execution: default-jar}]
> [INFO] Building jar:
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> [INFO] [install:install {execution: default-install}]
> [INFO] Installing
>
> /Users/crowmobe/Dev/projects/TychoExample/pomfirst-bundle/target/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> to
>
> /Users/crowmobe/.m2/repository/com/jha/yhs/pomfirst-bundle/0.1.0-SNAPSHOT/pomfirst-bundle-0.1.0-SNAPSHOT.jar
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 6 seconds
> [INFO] Finished at: Mon Jan 10 16:51:16 CST 2011
> [INFO] Final Memory: 24M/246M
> [INFO]
> ------------------------------------------------------------------------
>



-- 
Cheers, Stuart