<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Apply lombok for Ivy project</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project</link><description>&lt;p&gt;Hello Ivy Team,
As you know, lombok is using for reducing boilerplate code.
But applying for Ivy project is quite very difficult:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For the designer, it works perfectly (configuration likes eclipse)&lt;/li&gt;
&lt;li&gt;For maven build (using Axon.ivy Project Build Plugin), it doesn't work except I do a work-arround by using delombok plugin (&lt;a href="https://projectlombok.org/features/delombok)"&gt;https://projectlombok.org/features/delombok)&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;But it's very annoying in declaration of pom file and building process:&lt;/li&gt;
&lt;li&gt;For details, in maven build process, it has to do:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;
    1. backup src folder to src_temp folder.
    2. delombok src (some lombok java classes are delomboked --&amp;gt; they are using for compilation)
    3. After compilation, restore 'src_temp' folder to src folder (for reverting the original source code)
    --&amp;gt; if the exception occurs (for ex: compile error) --&amp;gt; step 3 is NOT executed --&amp;gt; So, I have to restore manually by myself (It's very annoying if build exception occurs frequently)
&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupid&amp;gt;org.projectlombok&amp;lt;/groupid&amp;gt;
    &amp;lt;artifactid&amp;gt;lombok-maven-plugin&amp;lt;/artifactid&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;lombok-code&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;generate-sources&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;delombok&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;
                &amp;lt;sourcedirectory&amp;gt;src&amp;lt;/sourcedirectory&amp;gt;
                &amp;lt;addoutputdirectory&amp;gt;false&amp;lt;/addoutputdirectory&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;artifactid&amp;gt;maven-resources-plugin&amp;lt;/artifactid&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;copy-src-to-src_temp&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;validate&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;copy-resources&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;overwrite&amp;gt;true&amp;lt;/overwrite&amp;gt;
                &amp;lt;outputdirectory&amp;gt;target/src_temp&amp;lt;/outputdirectory&amp;gt;
                &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;
                &amp;lt;resources&amp;gt;
                    &amp;lt;resource&amp;gt;
                        &amp;lt;directory&amp;gt;src&amp;lt;/directory&amp;gt;
                        &amp;lt;include&amp;gt;&lt;strong&gt;/*.java&amp;lt;/include&amp;gt;
                    &amp;lt;/resource&amp;gt;
                &amp;lt;/resources&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;copy-delombok-source-to-src&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;process-sources&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;copy-resources&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;overwrite&amp;gt;true&amp;lt;/overwrite&amp;gt;
                &amp;lt;outputdirectory&amp;gt;src&amp;lt;/outputdirectory&amp;gt;
                &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;
                &amp;lt;resources&amp;gt;
                    &amp;lt;resource&amp;gt;
                        &amp;lt;directory&amp;gt;target/generated-sources/delombok&amp;lt;/directory&amp;gt;
                        &amp;lt;include&amp;gt;&lt;/strong&gt;/&lt;em&gt;.java&amp;lt;/include&amp;gt;
                    &amp;lt;/resource&amp;gt;
                &amp;lt;/resources&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;copy-src_temp-to-src-install-phase&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;install&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;copy-resources&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;overwrite&amp;gt;true&amp;lt;/overwrite&amp;gt;
                &amp;lt;outputdirectory&amp;gt;src&amp;lt;/outputdirectory&amp;gt;
                &amp;lt;encoding&amp;gt;UTF-8&amp;lt;/encoding&amp;gt;
                &amp;lt;resources&amp;gt;
                    &amp;lt;resource&amp;gt;
                        &amp;lt;directory&amp;gt;target/src_temp&amp;lt;/directory&amp;gt;
                        &amp;lt;include&amp;gt;&lt;/em&gt;&lt;em&gt;/&lt;/em&gt;.java&amp;lt;/include&amp;gt;
                    &amp;lt;/resource&amp;gt;
                &amp;lt;/resources&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;

&lt;p&gt;If you have other idea or other way for configuration, pls let me know!&lt;/p&gt;
&lt;p&gt;Many thanks!
Hap Em,&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 06 Dec 2019 11:15:36 -0500</lastBuildDate><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#4256</link><description>&lt;p&gt;Hi &lt;a href="https://answers.axonivy.com/users/1209/tareqk"&gt;&lt;a href="https://answers.axonivy.com/users/1209/tareqk"&gt;@TareqK&lt;/a&gt;&lt;/a&gt; 
no unfortunately this issue got no priority on the roadmap so there is still no native support for it. 
What can work for some cases where annotation magic is required: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;use &lt;a href="http://axonivy.github.io/project-build-plugin/release/8.0/share-engine-core-classpath-mojo.html"&gt;share-engine-core-classpath&lt;/a&gt; to get a valid classpath for ivy.core deps&lt;/li&gt;
&lt;li&gt;compile with a classic maven-compiler-plugin and its associated stack (using the classpath property)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;But I'd only do this in an isolated base project with a specific scope. Since ivy compile functionality will be missing...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Fri, 06 Dec 2019 11:15:36 -0500</pubDate><guid>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#4256</guid></item><item><title>Comment by TareqK on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#4247</link><description>&lt;p&gt;Is there any update on this? Do annotation processors work out of the box for newer platforms (7.0+)?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TareqK</dc:creator><pubDate>Fri, 06 Dec 2019 03:08:27 -0500</pubDate><guid>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#4247</guid></item><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#2916</link><description>&lt;p&gt;The idea was to make options from the JDT compiler, such as annotationProcessing, available for users of the project-build-plugin. The driver for it was lombok. 
But as lombok annotation processing did not solve the lombok build issues when using the project-build-plugin, we also did not invent these options as part of the project-build-plugin &lt;code&gt;compile&lt;/code&gt; goals.
Still I can imagine other scenarios where an annotationProcessing option would be required. But I didn't want to support it while there is no real project that really uses the feature.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Fri, 13 Oct 2017 04:37:43 -0400</pubDate><guid>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#2916</guid></item><item><title>Comment by Hap Em on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#2913</link><description>&lt;p&gt;Hello Reguel,&lt;/p&gt;
&lt;p&gt;In the XIVY-1606, I saw you have the patch "lombokOptions.patch" --&amp;gt; As i understand, the change code is using for annotationProcessors (especially, lombok project). &lt;/p&gt;

&lt;p&gt;What is the status of this code? is it merged to new ivy version?&lt;/p&gt;
&lt;p&gt;Thanks!
Hap Em,&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Fri, 13 Oct 2017 04:15:59 -0400</pubDate><guid>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project#2913</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project/2909</link><description>&lt;p&gt;What I know is that from the ivy.core there has been some investigation in making the  &lt;code&gt;project-build-plugin&lt;/code&gt; able to compile with lombok. &lt;a href="https://jira.axonivy.com/jira/browse/XIVY-1606"&gt;https://jira.axonivy.com/jira/browse/XIVY-1606&lt;/a&gt; But that approach failed. 
Roughly concluded lombok is very cool for the user, but the integration into eclipse and other tools has been done very dirty. And its not easy to apply them anywhere else...&lt;/p&gt;
&lt;p&gt;In my opinion there is also no big need to use lombok in ivy projects. Yes you have some extra features such as builders for your pojos. But we already provide a simple way to define POJOs via DataClasses. As with lombok you have an easy Editor to define classes and its properties. And you have the same drawbacks such as very weak refactoring support...&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 11 Oct 2017 06:40:05 -0400</pubDate><guid>https://answers.axonivy.com/questions/2908/apply-lombok-for-ivy-project/2909</guid></item></channel></rss>