You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Tommy Svensson <to...@natusoft.se> on 2013/07/20 20:57:08 UTC

Prolbem with maven-bundle-plugin version 2.4.0

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: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Prolbem with maven-bundle-plugin version 2.4.0

Posted by Tommy Svensson <to...@natusoft.se>.
Yeah, that would have been the smart thing to do! Unfortunately that now failed since if I do something simple it works, even a war produces classes! 

I interpret this as a non backwards compatibility in the newest version since as I said if I got back to version 2.3.7 it all builds fine! It is far from obvious what is different, and what I need to do to be compatible with version 2.4.0. 

/Tommy


20 jul 2013 kl. 21:14 skrev Stuart McCulloch <mc...@gmail.com>:

> Could you reduce this down to a test project that recreates the issue?
> 
> On 20 Jul 2013, at 19:57, Tommy Svensson wrote:
> 
>> 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: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


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


Re: Prolbem with maven-bundle-plugin version 2.4.0

Posted by Stuart McCulloch <mc...@gmail.com>.
Could you reduce this down to a test project that recreates the issue?

On 20 Jul 2013, at 19:57, Tommy Svensson wrote:

> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


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