FHIR Chat · HAPI 1.6 parent POM issue · implementers

Stream: implementers

Topic: HAPI 1.6 parent POM issue


view this post on Zulip Anthony Sute (Aug 26 2016 at 22:21):

Hi @James Agnew et al:
While doing a Maven build with HAPI 1.6, the animal-sniffer-maven-plugin (check-java-api) complained about signatures we were using with Java 1.8. It turns out that the parent hapi-deployable-pom POM.xml has the following snippet which is instructing the animal-sniffer-maven-plugin to validate signatures against Java 1.6:

                    <configuration>
                        <signature>
                            <groupId>org.codehaus.mojo.signature
                            </groupId>
                            <artifactId>java16</artifactId>
                            <version>1.1</version>
                        </signature>
                    </configuration>

However, maven-enforcer-plugin in hapi-fhir.pom requires Java 1.8:

                <execution>
                    <id>enforce-java</id>
                    <goals>
                        <goal>enforce</goal>
                    </goals>
                    <configuration>
                        <rules>
                            <requireJavaVersion>
                                <version>[1.8,)</version>
                                <message>
                                    The hapi-fhir Maven build requires JDK version 1.8 or higher.
                                </message>
                            </requireJavaVersion>
                        </rules>
                    </configuration>
                </execution>

Therefore, I believe we would need all of the "org.codehaus.mojo.signature" references in the POM's changed to:

                    <configuration>
                        <signature>
                            <groupId>org.codehaus.mojo.signature
                            </groupId>
                            <artifactId>java18</artifactId>
                            <version>1.0</version>
                        </signature>
                    </configuration>

When we changed our local cached hapi-deployable-pom to what's above, our build worked perfectly. Thanks in advance.

view this post on Zulip James Agnew (Aug 29 2016 at 11:23):

Hi @Anthony Sute ,

The situation you found is actually deliberate. We target Java 1.6 for the built library (aside from the CLI module) because there are still people using it in that environment. On the other hand, our build itself requires 1.8 because a few of the unit test dependencies require it (namely Jetty).

view this post on Zulip Anthony Sute (Aug 29 2016 at 14:50):

Is there the expectation that Java 1.8 application implementers change their local instance of the hapi-deployable-pom pom.xml file in order for animal-sniffer to not raise signature errors when 1.7 and 1.8-specific classes are used? Should we not be using the hapi-deployable-pom as a parent POM, even though there are encouragements in the code for implementers to do so? Is the animal-sniffer plug-in really necessary in the hapi-deployable-pom?

view this post on Zulip Anthony Sute (Aug 29 2016 at 14:52):

If the above is true, I'm concerned about our client raising concerns about the need to modify a local instance of a Maven dependency pom.xml in order to build a 1.8 application.

view this post on Zulip Ioana Singureanu (Aug 29 2016 at 19:03):

Hi @James Agnew , would it be easier for application developers to add the Java JRE, perhaps (using the AnimalSniffer plugin)?

view this post on Zulip James Agnew (Aug 29 2016 at 22:08):

Ahhh I see where you are coming from.

The intention is actually not for you to use this as your parent pom in your own projects. I can see why you would, the example HAPI project does use it. I think we should probably fix the example- I'm using it because it helps me to make sure we don't accidentally introduce any Java 8-isms into the examples, but there is no reason you can't use Java 8 stuff in your own projects if you aren't worrying about supporting Java 6.

view this post on Zulip Anthony Sute (Aug 29 2016 at 22:32):

To confirm, you're saying I shouldn't use the hapi-fhir POM in my own project even though the JAX-RS Server Example does below? The way the comment is phrased, it seems to indicate that one could use the parent POM in order to ensure all of the relevant dependencies are present.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- Note: HAPI projects use the "hapi-fhir" POM as their base to provide easy management. You do not need to use this in your own projects, so the "parent" tag and it's contents below may be removed 
    if you are using this file as a basis for your own project. -->
<parent>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>hapi-fhir</artifactId>
    <version>1.6</version>
    <relativePath>../pom.xml</relativePath>
</parent>

<artifactId>hapi-fhir-jaxrsserver-example</artifactId>
<packaging>war</packaging>

<name>HAPI FHIR JAX-RS Server - Example</name>

...

view this post on Zulip James Agnew (Aug 29 2016 at 23:07):

Now I'm confused again...

You don't need to use either at all. The reason the examples use them is because they supply a bunch of sensible defaults and dependency versions. That could be useful to you though..

The hapi-deployable-pom specifically seems like a bad one to use, since it brings in the Java6 sniffer. I thought that was the one you were using... The hapi-fhir one does not bring in animal sniffer, so it's probably fine to use. It does declare to compile at Java 6 level but you can override that in your own pom if you want something newer.

Which one are you using?

view this post on Zulip James Agnew (Aug 29 2016 at 23:14):

Oh wait! The parent pom does in fact bring in animal sniffer. That shoudn't be!

Now I see why you're having this issue. Sorry! Will fix that now.

view this post on Zulip Anthony Sute (Sep 01 2016 at 01:59):

Thanks for the clarification. I agree that the hapi-deployable-pom is the wrong one to use. We switched to the hapi-fhir one as parent and it actually worked. However the animal-sniffer is invoked in the hapi-fhir pom seems to be different than in hapi-deployable-pom. Yes, as you point out, the good thing about the hapi-fhir one is the list of sensible defaults and dependency versions we don't need to manually copy over to our application's POM. Regarding the fixes you'll make, where can I pick them up? Will they be in the nightly build version or could you forward me the fixed pom?


Last updated: Apr 12 2022 at 19:14 UTC