Class in different directory than declared
------------------------------------------

                 Key: FELIX-3450
                 URL: https://issues.apache.org/jira/browse/FELIX-3450
             Project: Felix
          Issue Type: Bug
          Components: Maven Bundle Plugin
    Affects Versions: maven-bundle-plugin-2.3.7
         Environment: Maven 3.0.4
OSX Lion
Java 6_29
            Reporter: Rune Engseth


I'm new to maven-bundle-plugin, but here goes.

Background: 
I have some code that relies on a custom jar file. 
This custom jar file has artifactId "verticalsite", and contains custom code 
packaged with all its dependecies, e.g. Spring, Logging framework etc inlined.
This jar has been built using maven-assembly-plugin.

Now I want to build an extension to Tivoli Federated Identity Manager as an 
OSGi bundle.
The custom jar should be included in the Bundle as a jar file (not inlined)


This is how my pom looks like:

<project>

    <modelVersion>4.0.0</modelVersion>
    <groupId>no.company.tfim.plugin</groupId>
    <artifactId>groupsynch</artifactId>
    <packaging>bundle</packaging>
    <version>1.0.0</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                    </archive>
                    <instructions>
                        
<Embed-Dependency>verticalsite;scope=compile;inline=false</Embed-Dependency>
                        (+ 2 other instructions)
                    </instructions>
                </configuration>
            </plugin>
        </plugins>

    </build>

    <dependencies>
        <dependency>
            <groupId>no.company</groupId>
            <artifactId>verticalsite</artifactId>
            <version>3.2-jar-with-dependencies</version>
            <scope>compile</scope>
        </dependency>
                rest of my deps goes here..
    </dependencies>

</project>


The structur of my project is:

./pom.xml
./src/main/java (plugin code goes here)
./src/main/resources/plugin.xml



The problem
When running the build with this pom, a get a lot of errors similiar to this:
[ERROR] Bundle no.company.tfim.plugin:groupsynch:jar:1.0.0 : Class in different 
directory than declared. Path from class name is 
no/company/verticalsite/VerticalSiteConfig.class but the path in the jar is 
target/classes/no/company/verticalsite/VerticalSiteConfig.class from 
'Jar:verticalsite-3.2-jar-with-dependencies.jar'


So, I want to include the jar file, and set the Bundle-Classpath.
<Embed-Dependency>verticalsite;scope=compile;inline=false</Embed-Dependency> 
tells the bundle-plugin to include all deps with scope "compile", and inline is 
set to false. 

However I tweak the other instructions like import/export packages, 
include-resource I get the same errors

When removing the Embed-Dependency instruction, the build is successfull, but 
the jar is not included. 

When removing all other instructions, (only Embed-Dependency left), the build 
still fails. 


I have tried posting at the user-list, but no response, so I am now creating a 
jira.

The bug seems to be fixed in FELIX-660, but I get the same errors, so probably 
related. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to