Hello Ivy Team, As you know, lombok is using for reducing boilerplate code. But applying for Ivy project is quite very difficult:

  • For the designer, it works perfectly (configuration likes eclipse)
  • For maven build (using Axon.ivy Project Build Plugin), it doesn't work except I do a work-arround by using delombok plugin (https://projectlombok.org/features/delombok)
  • But it's very annoying in declaration of pom file and building process:
  • For details, in maven build process, it has to do:

1. backup src folder to src_temp folder. 2. delombok src (some lombok java classes are delomboked --> they are using for compilation) 3. After compilation, restore 'src_temp' folder to src folder (for reverting the original source code) --> if the exception occurs (for ex: compile error) --> step 3 is NOT executed --> So, I have to restore manually by myself (It's very annoying if build exception occurs frequently)


<plugin>
    <groupid>org.projectlombok</groupid>
    <artifactid>lombok-maven-plugin</artifactid>
    <executions>
        <execution>
            <id>lombok-code</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>delombok</goal>
            </goals>
            <configuration>
                <encoding>UTF-8</encoding>
                <sourcedirectory>src</sourcedirectory>
                <addoutputdirectory>false</addoutputdirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <artifactid>maven-resources-plugin</artifactid>
    <executions>
        <execution>
            <id>copy-src-to-src_temp</id>
            <phase>validate</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <overwrite>true</overwrite>
                <outputdirectory>target/src_temp</outputdirectory>
                <encoding>UTF-8</encoding>
                <resources>
                    <resource>
                        <directory>src</directory>
                        <include>/*.java</include>
                    </resource>
                </resources>
            </configuration>
        </execution>
        <execution>
            <id>copy-delombok-source-to-src</id>
            <phase>process-sources</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <overwrite>true</overwrite>
                <outputdirectory>src</outputdirectory>
                <encoding>UTF-8</encoding>
                <resources>
                    <resource>
                        <directory>target/generated-sources/delombok</directory>
                        <include>/.java</include>
                    </resource>
                </resources>
            </configuration>
        </execution>
        <execution>
            <id>copy-src_temp-to-src-install-phase</id>
            <phase>install</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <overwrite>true</overwrite>
                <outputdirectory>src</outputdirectory>
                <encoding>UTF-8</encoding>
                <resources>
                    <resource>
                        <directory>target/src_temp</directory>
                        <include>/.java</include>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

If you have other idea or other way for configuration, pls let me know!

Many thanks! Hap Em,

asked 11.10.2017 at 02:42

Hap%20Em's gravatar image

Hap Em
(suspended)
accept rate: 0%


What I know is that from the ivy.core there has been some investigation in making the project-build-plugin able to compile with lombok. https://jira.axonivy.com/jira/browse/XIVY-1606 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...

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...

link

answered 11.10.2017 at 06:40

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 11.10.2017 at 06:47

Hello Reguel,

In the XIVY-1606, I saw you have the patch "lombokOptions.patch" --> As i understand, the change code is using for annotationProcessors (especially, lombok project).

What is the status of this code? is it merged to new ivy version?

Thanks! Hap Em,

(13.10.2017 at 04:15) Hap Em Hap%20Em's gravatar image

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 compile 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.

(13.10.2017 at 04:37) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

Is there any update on this? Do annotation processors work out of the box for newer platforms (7.0+)?

(06.12.2019 at 03:08) TareqK TareqK's gravatar image

Hi @TareqK 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:

  1. use share-engine-core-classpath to get a valid classpath for ivy.core deps
  2. compile with a classic maven-compiler-plugin and its associated stack (using the classpath property)

But I'd only do this in an isolated base project with a specific scope. Since ivy compile functionality will be missing...

(06.12.2019 at 11:15) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×22
×9

Asked: 11.10.2017 at 02:42

Seen: 3,163 times

Last updated: 06.12.2019 at 11:16