eeverman / andhow

Java configuration simplified.
https://www.andhowconfig.org
Apache License 2.0
23 stars 34 forks source link

Create a maven BOM pom module for AndHow #529

Open eeverman opened 3 years ago

eeverman commented 3 years ago

AndHow is currently distributed as a 'fat' jar created from the contents of two jars: anyhow-core.jar and andhow-annotation-processor.jar, both of which are created in this project.

This is really just to simplify things so AndHow can be included as a single Maven dependency, however, if you want to create the smallest deployable artifact possible for an application, you can do better. The actual requirement for AndHow in an application is this:

Thus, a BOM style pom file with a dependencyManagement section that includes andhow-annotation-processor.jar as provided scope and anyhow-core.jar as compile scope would provide an easy path for users who want to create the smallest possible app.

To complete this:

alex-kar commented 3 years ago

@eeverman I would like to take it, but I'm not sure I understand the idea. If we create new module andow-bom with dependencyManagment section and import it in example-app-2 as

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>andhow-bom</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Then we anyway should reference those dependencies andhow-annotation-processor and anyhow-core in dependencies section, otherwise they won't be include.

eeverman commented 3 years ago

@alex-kar Right, its low priority. This is really intended for people who want to create as small a jar as possible - Probably because they want a lambda to startup quickly. Only 'core' is needed at runtime - you can leave out the annotation-processor. But, to do that, you have to know what you are doing and get the scopes of the dependencies correct. This was intended to simplify that because the dependency management will bring in the scopes.

This would require some testing to make sure it works as expected (I didn't test this out, but this seems like the way BOMs are supposed to work - I'm not sure if the provided scope adds any wrinkles).

I'll pull the 'help wanted tag' off and assign to you - feel free to ignore for as long as you want.