Extract version number from pom.xml to reduce duplication of the version number

This commit is contained in:
Yannik Hampe
2017-05-29 18:28:08 +02:00
parent b52d5b9e29
commit 0b86dcd8fe
4 changed files with 20 additions and 5 deletions

13
pom.xml
View File

@@ -120,6 +120,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>filtering-java-templates</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<mailingLists>

View File

@@ -0,0 +1,5 @@
package org.mustangproject.ZUGFeRD;
public final class Version {
public static final String VERSION = "${project.version}";
}

View File

@@ -237,7 +237,6 @@ public class ZUGFeRDExporter implements Closeable {
// // MAIN CLASS
private PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
private String versionStr = "1.4.1";
// BASIC, COMFORT etc - may be set from outside.
private ZUGFeRDConformanceLevel zUGFeRDConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED;
@@ -466,7 +465,7 @@ public class ZUGFeRDExporter implements Closeable {
String creator, boolean attachZugferdHeaders) throws IOException,
TransformerException {
String fullProducer = producer + " (via mustangproject.org "
+ versionStr + ")";
+ Version.VERSION + ")";
PDDocumentCatalog cat = doc.getDocumentCatalog();
PDMetadata metadata = new PDMetadata(doc);

View File

@@ -29,8 +29,6 @@ import java.io.InputStream;
import java.util.GregorianCalendar;
public class ZUGFeRDExporterFromA1Factory {
private static final String VERSION_STR = "1.4.0";
private boolean ignoreA1Errors = false;
private ZUGFeRDConformanceLevel zugferdConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED;
private PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.U;
@@ -89,7 +87,7 @@ public class ZUGFeRDExporterFromA1Factory {
}
private void makePDFA3compliant(PDDocument doc) throws IOException {
String fullProducer = producer + " (via mustangproject.org " + VERSION_STR + ")";
String fullProducer = producer + " (via mustangproject.org " + Version.VERSION + ")";
PDDocumentCatalog cat = doc.getDocumentCatalog();
PDMetadata metadata = new PDMetadata(doc);