repaint-io / maven-tiles

Injecting maven configurations by composition rather than inheritance
155 stars 32 forks source link

Readme with detailed example for tile merge covered by PR #101 ? #123

Open fishermans opened 3 years ago

fishermans commented 3 years ago

Please excuse to ask for documentation here. From the beginner's point-of-view it is hard to understand to options for merging tile aspects.

I cannot find any good example for Rob's merge option. It would be nice to get some more information for merge capabilities in readme.

Which option of the discussed ones in the PR #101 is available for now?

How to manage annotationProcessorPaths, annotationProcessors and compilerArgs on the maven-compiler-plugin in detail?

Is it possible merge two or more tiles here and have the capability to also deliver the merge sources separately which also can contain additional plugin configuration, e.g. preprocessing by resource plugin configs?

Limitations?

A good example is welcome!

fishermans commented 3 years ago

In addition:

In my concrete case I would like to merge Annotation Processing for Ebean and MapStruct. All of them are using Lombok. So the target result looks like that:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration tiles-keep-id="true">
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok-mapstruct-binding</artifactId>
                            <version>${lombok-mapstruct-binding.version}</version>
                        </path>
                        <path>
                            <groupId>io.ebean</groupId>
                            <artifactId>querybean-generator</artifactId>
                            <version>${ebean.version}</version>
                        </path>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <annotationProcessors>
                        <annotationProcessor>
                            lombok.launch.AnnotationProcessorHider$AnnotationProcessor
                        </annotationProcessor>
                        <annotationProcessor>
                            io.ebean.querybean.generator.Processor
                        </annotationProcessor>
                        <annotationProcessor>
                            org.mapstruct.ap.MappingProcessor
                        </annotationProcessor>
                    </annotationProcessors>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
                        <arg>-Amapstruct.suppressGeneratorVersionInfoComment=true</arg>
                        <arg>-Amapstruct.verbose=true</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
rvowles commented 3 years ago

I use it to enable Kotlin in FeatureHub: https://github.com/featurehub-io/featurehub/blob/master/backend/tile-java/tile.xml

fishermans commented 3 years ago

I use it to enable Kotlin in FeatureHub: https://github.com/featurehub-io/featurehub/blob/master/backend/tile-java/tile.xml

Richard, thanks a lot for your reply. I looked at your repository and got some good ideas on how to invoke docker tests. Thanks for that.

Regarding the main issue here, I do not see any configuration in the mentioned tile on how to merge compiler annotation processing even on the kotline plugin which I am not aware of.

Rob (vendor of ebean) added some new functionality defining a target tile and some source tiles that got merged during tile evaluation.

Background: Since I have to provide a more common approach for several different (customer and product) projects at our company that have to follow the same lifecycle, I am looking for a smart way to manage all the different flavours we have to handle.

This great tiles plugin will make my day. I just need to know how to configure it correctly. The readme is to small for all the options. Youtube and SO also do not help much, here.

I know, writing readmes and docs is boring but for newbies the only option...

rbygrave commented 3 years ago

@fishermans The tiles I did are at: https://github.com/avaje/kotlin-kapt - there is some description of "how this works" in the readme there. Is that what you are looking for?

rbygrave commented 3 years ago

Regarding the missing README documentation, that is really on me. My only defense is that this "feature" was relatively experimental at the time and Mark and Richard were kind enough to let it go in without being perhaps 100% on board with it.

rbygrave commented 3 years ago

In the "tile-merge-target" tile: https://github.com/avaje/kotlin-kapt/blob/master/tile-kapt/tile.xml#L9 ... has <tile-merge-target>true</tile-merge-target> https://github.com/avaje/kotlin-kapt/blob/master/tile-kapt/tile.xml#L39 ... has the tiles-append="annotationProcessorPaths"

In the "tile-merge-source" tile: https://github.com/avaje/kotlin-kapt/blob/master/tile-kapt-querybean-generator/tile.xml#L9 ... has <tile-merge-source>true</tile-merge-source>

I believe that is all that is needed @fishermans

fishermans commented 3 years ago

Thanks @rbygrave! That is really helpful.

I will give it a try next week. 👍