[hibernate-dev] Build and AnnotationProcessors

Steve Ebersole steve at hibernate.org
Wed Apr 17 12:24:35 EDT 2013


On Wed 17 Apr 2013 11:08:28 AM CDT, Hardy Ferentschik wrote:
>
> On 17 Jan 2013, at 5:32 PM, Steve Ebersole <steve at hibernate.org> wrote:
>
>> As discussed a little in HHH-8140[1] and on the earlier Eclipse thread,
>> I'd like to look at simplifying the build a bit around making IDE setup
>> easier.  One thing that came to mind was looking at source generation.
>> Today we have source generation occur for:
>> * Antlr
>> * JAXB
>> * JPA static metamodel gen
>> * Logging
>>
>> The first 2 rely on specific tools while the other 2 are generated via
>> AnnotationProcessors.
>>
>> For the first 2, there is really not much to discuss aside from possibly
>> to consider adding those outputs to Git.  I'd actually be open to
>> considering that for JAXB.
>
> Personally I would not check them in. In my world generated classes don't
> belong into the repository.

I agree with you generally speaking.  JAXB generated bindings just 
feels like a different beast to me.  Really how often does the XSD 
change?


>> But really it is the AnnotationProcessors I wanted to talk about.
>> Currently we apply the AnnotationProcessors in separate javac task
>> configurations.  I cannot remember all the reasons we decided to do it
>> this way originally.  But I know that one was wanting to be able to keep
>> the output of each (the generated sources) in dedicated directories[2].
>
> This reminds me of not so distant discussion on jboss-dev ;-)
> I still believe it is nice to have a different output directory for each annotation
> processor and I also like the idea of keeping things separate in the build.
> IMO it is completely valid to run the processors separately from the main javac call.
>
> I know this creates problems in the IDE setup, but the limiting factor in this case
> is the IDE.

It does not really cause "problems" per-se.  It causes uncertainty.  As 
a user, who is not a Hibernate developer, I think it is hard to 
understand why the IDE project is not "valid" after I import it.  Maybe 
this is just another argument for managing the compilation and 
generated-source outputs separately for command line and IDE projects.


>> But we could also just lump all the APT output into one single, separate
>> directory (target/generated-src/apt/main, target/generated-src/apt/test,
>> e.g.).  What this would gain us is the ability for the IDE to run APT as
>> part of normal javac.  It would be one less thing to set up when setting
>> up the IDE project.
>
> Since I drive the build most of the time from the command line I don't care
> that the IDE is not doing the APT processing. For me a nicely organised
> build outweighs simpler IDE setup.

Is it really more organized/nicer?  Not sure about you, but I can tell 
you how often I navigate into generated-src directory... Never.



More information about the hibernate-dev mailing list