Refactor fatjar (#6)

This commit is contained in:
James Agnew 2019-02-04 07:53:46 -05:00 committed by GitHub
parent cef1965346
commit bf8a7aa3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 14 deletions

View File

@ -512,12 +512,12 @@ public class Element extends Base {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<ElementDecoration> decorations = (List<ElementDecoration>) getUserData("fhir.decorations"); List<ElementDecoration> decorations = (List<ElementDecoration>) getUserData("fhir.decorations");
if (decorations == null) { if (decorations == null) {
decorations = new ArrayList<ElementDecoration>(); decorations = new ArrayList<>();
setUserData("fhir.decorations", decorations); setUserData("fhir.decorations", decorations);
} }
decorations.add(new ElementDecoration(DecorationType.TYPE, profile.getUserString("path"), definition.getPath())); decorations.add(new ElementDecoration(DecorationType.TYPE, profile.getUserString("path"), definition.getPath()));
if (tail(definition.getId()).contains(":")) { if (definition.getId() != null && tail(definition.getId()).contains(":")) {
String[] details = tail(definition.getId()).split("\\:"); String[] details = tail(definition.getId()).split(":");
decorations.add(new ElementDecoration(DecorationType.SLICE, null, details[1])); decorations.add(new ElementDecoration(DecorationType.SLICE, null, details[1]));
} }
} }

View File

@ -55,28 +55,63 @@
<build> <build>
<plugins> <plugins>
<!--
Build a fatjar containing all depenedncies
-->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>3.2.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <id>unpack-dependencies</id>
<phase>process-classes</phase>
<goals> <goals>
<goal>shade</goal> <goal>unpack-dependencies</goal>
</goals> </goals>
<configuration> <configuration>
<shadedClassifierName/> <excludes>**/module-info.class</excludes>
<transformers> <outputDirectory>${project.build.directory}/classes</outputDirectory>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <overWriteReleases>false</overWriteReleases>
<mainClass>org.hl7.fhir.r4.validation.Validator</mainClass> <overWriteSnapshots>true</overWriteSnapshots>
</transformer> <excludeScope>test</excludeScope>
</transformers> <includeScope>compile</includeScope>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.hl7.fhir.r4.validation.Validator</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!--
These two plugins provide quality checks that don't make sense to perform
on a fatjar.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>