Hello,

I have found some problems with maven-bundle-plugin version 2.4.0:

It keeps spitting out the following error:

        [ERROR] Bundle se.natusoft.osgi.aps:aps-apis:bundle:0.9.2 : The default 
package '.' is not permitted by the Import-Package syntax. 
        This can be caused by compile errors in Eclipse because Eclipse creates 
        valid class files regardless of compile errors.
        The following package(s) import from the default package null

My Import-Package looks like this:

        <Import-Package>*</Import-Package>

This works fine up to version 2.3.7. And no, I'm not using Eclipse. 

I got the source for the 2.4.0 version and realized that the error actually 
comes from bnd. I tried the following "fix":
__________________________________________________________________________________

    protected boolean reportErrors( String prefix, Analyzer analyzer )
    {
        List errors = analyzer.getErrors();
        List warnings = analyzer.getWarnings();

        for ( Iterator w = warnings.iterator(); w.hasNext(); )
        {
            String msg = ( String ) w.next();
            getLog().warn( prefix + " : " + msg );
        }

        boolean hasErrors = false;
        String fileNotFound = "Input file does not exist: ";
        for ( Iterator e = errors.iterator(); e.hasNext(); )
        {
            String msg = ( String ) e.next();
            if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) )
            {
                // treat as warning; this error happens when you have duplicate 
entries in Include-Resource
                String duplicate = Processor.removeDuplicateMarker( 
msg.substring( fileNotFound.length() ) );
                getLog().warn( prefix + " : Duplicate path '" + duplicate + "' 
in Include-Resource" );
            }
            // ---- MY ADDITION ----
            else if ( msg.contains("The default package '.'")) {
                getLog().warn( prefix + ":" + msg );
            }
            // -----------------------------
            else
            {
                getLog().error( prefix + " : " + msg );
                hasErrors = true;
            }
        }
        return hasErrors;
    }
__________________________________________________________________________________

Then it builds and creates a perfectly fine jar. 

However when my build came to the war:s no classes are produced in 
target/classes and then maven-bundle-plugin/bnd complains about not finding the 
specified activator, which is then correct since no classes were produced! No 
compilation errors either. There is nothing wrong with the code being compiled. 
If I go down to version 2.3.7 of the plugin it compiles fine and produces 
classes. 

Unfortunately Java 1.7 is only supported by version 2.4.0. 

-- Tommy Svensson


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to