You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Niklaus Giger <ni...@member.fsf.org> on 2012/05/03 21:39:37 UTC

Opened Ticket BUILDR-641: should allow java files without a class definition (e.g package-info.java)

Hi

I stumbled in my project about various files, which where created just to 
generate javadoc and had no valid class definition.

My colleague argued that this behaviour is okay as documented under
http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles

Did anybody else stumble about this problem? 
Or is there somewhere a simple way to exclude out package-info.java files from 
projecte.compile.sources?

Thanks in advance for your help.

Best regards

-- 
Niklaus Giger

Re: Opened Ticket BUILDR-641: should allow java files without a class definition (e.g package-info.java)

Posted by Niklaus Giger <ni...@member.fsf.org>.
Hi Alex

Thanks a lot for your workaround! It is a nice workaround for the time being.

Best regards

Niklaus

> Hi Niklaus,
> 
> Yes, that's a bug -- we should exclude these types of files from
> dependencies.
> 
> Here's a quick hackish workaround for the time being,
> 
> # Monkey-patch Javac compiler to exclude package-info.java from
> dependencies module Buildr
>   module Compiler
>     class Javac
>       protected
>       def compile_map(sources, target)
>         map = super(sources, target)
>         map.reject { |k, v| k =~ /package-info.java$/ }
>       end
>     end
>   end
> end
> 
> alex
> 
> 
> On Thu, May 3, 2012 at 12:39 PM, Niklaus Giger
> <niklaus.giger@member.fsf.org
> 
> > wrote:
> > 
> > Hi
> > 
> > I stumbled in my project about various files, which where created just to
> > generate javadoc and had no valid class definition.
> > 
> > My colleague argued that this behaviour is okay as documented under
> > 
> > http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html
> > #sourcefiles
> > 
> > Did anybody else stumble about this problem?
> > Or is there somewhere a simple way to exclude out package-info.java files
> > from
> > projecte.compile.sources?
> > 
> > Thanks in advance for your help.
> > 
> > Best regards
> > 
> > --
> > Niklaus Giger
-- 
Niklaus Giger
Wieshoschet 6
CH-8753 Mollis
+41  (0)55 612 20 54 P
+41  (0)77 473 02 59 Mobil

Re: Opened Ticket BUILDR-641: should allow java files without a class definition (e.g package-info.java)

Posted by Alex Boisvert <al...@gmail.com>.
Hi Niklaus,

Yes, that's a bug -- we should exclude these types of files from
dependencies.

Here's a quick hackish workaround for the time being,

# Monkey-patch Javac compiler to exclude package-info.java from dependencies
module Buildr
  module Compiler
    class Javac
      protected
      def compile_map(sources, target)
        map = super(sources, target)
        map.reject { |k, v| k =~ /package-info.java$/ }
      end
    end
  end
end

alex


On Thu, May 3, 2012 at 12:39 PM, Niklaus Giger <niklaus.giger@member.fsf.org
> wrote:

> Hi
>
> I stumbled in my project about various files, which where created just to
> generate javadoc and had no valid class definition.
>
> My colleague argued that this behaviour is okay as documented under
>
> http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#sourcefiles
>
> Did anybody else stumble about this problem?
> Or is there somewhere a simple way to exclude out package-info.java files
> from
> projecte.compile.sources?
>
> Thanks in advance for your help.
>
> Best regards
>
> --
> Niklaus Giger
>