upd Maven pom (take back introduced java-templates)

to handle filtering of yacyBuildProperties.java.
To keep it compatible with ant filter directly from original sourcd/.... location.
This commit is contained in:
reger 2013-11-03 02:38:36 +01:00
parent d6760df3e5
commit 8ec350bad2
2 changed files with 24 additions and 106 deletions

View File

@ -1,78 +0,0 @@
package net.yacy.peers.operation;
import java.util.Locale;
import java.util.regex.Pattern;
/**
* Attention: this is a template file (a 1:1 copy of net/yacy/peers/operation/yacyBuildProperties.java
* to produce a genrated source filtered by the Maven build to replace the placeholder variables (like "@REPL_REVISION_NR@")
* with current build values.
*
*/
/**
* Properties set when compiling this release/version
*/
public final class yacyBuildProperties {
private yacyBuildProperties() {
}
/**
* returns the SVN-Revision Number as a String
*/
public static String getSVNRevision() {
final String revision = "@REPL_REVISION_NR@";
if (revision.contains("@") || revision.contains("$")) {
return "0";
}
return revision;
}
/**
* returns the version String (e. g. 0.9)
*/
public static String getVersion() {
if ("@REPL_VERSION@".contains("@") ) {
return "0.1";
}
return "@REPL_VERSION@";
}
public static final Pattern versionMatcher = Pattern.compile("\\A(\\d+\\.\\d{1,3})(\\d{0,5})\\z");
/**
* returns the long version String (e. g. 0.9106712)
*/
public static String getLongVersion() {
return String.format(Locale.US, "%.3f%05d", Float.valueOf(getVersion()), Integer.valueOf(getSVNRevision()));
}
/**
* returns the date, when this release was build
*/
public static String getBuildDate() {
if ("@REPL_DATE@".contains("@")) {
return "19700101";
}
return "@REPL_DATE@";
}
/**
* determines, if this release was compiled and installed
* by a package manager
*/
public static boolean isPkgManager() {
return "@REPL_PKGMANAGER@".equals("true");
}
/**
* returns command to use to restart the YaCy daemon,
* when YaCy was installed with a packagemanger
*/
public static String getRestartCmd() {
if ("@REPL_RESTARTCMD@".contains("@")) {
return "echo 'error'";
}
return "@REPL_RESTARTCMD@";
}
}

52
pom.xml
View File

@ -69,15 +69,15 @@
<configuration>
<excludes>
<!-- special exclude for compatibility with ant build script
note: the ant build uses a tricky source filtering to filter yacyBuildProperties.java
Note: the ant build uses a tricky source filtering to filter yacyBuildProperties.java
for the Maven build the original source for filtering has been copied to
libbuild/java-templates
and for maven the files in libbuild/java-templates are used for filtering to produce generated-sources.
For the ant build script the yacyBuildProperties.java must be at it's origianl location,
thus it is excluded here to prevent Maven compile error "duplicate source"
-->
<exclude>**/net/yacy/peers/operation/yacyBuildProperties.java</exclude>
</excludes>
<exclude>net/yacy/peers/operation/*.java</exclude>
</excludes>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
@ -196,28 +196,21 @@
<goals>
<goal>filter-sources</goal>
</goals>
<configuration>
<sourceDirectory>${basedir}/libbuild/java-templates</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<configuration>
<!-- sourceDirectory should be a separate template directory like
<sourceDirectory>${basedir}/libbuild/java-templates</sourceDirectory>
to not duplicate the yacyBuildProperties.java we use the original files as sourceDirectory
(to be compatible with the ant build.xml,
but it should be changed in future for both build systems to use a templateDirectory,
to eliminate the need of special compiler excludes
-->
<sourceDirectory>${basedir}/source/net/yacy/peers/operation</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/java/net/yacy/peers/operation</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- exec:exec goal to provide start YaCy by Maven (just to have it for cases were the ide not provides a run command) -->
<!--
@ -289,12 +282,14 @@
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
<!--
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
-->
</dependency>
<dependency>
@ -321,12 +316,14 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.5</version>
<!--
<exclusions>
<exclusion>
<artifactId>xz</artifactId>
<groupId>org.tukaani</groupId>
</exclusion>
</exclusions>
-->
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
@ -398,11 +395,6 @@
<artifactId>iri</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-jakarta-oro</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org</groupId>
<artifactId>jaudiotagger</artifactId>
@ -426,7 +418,7 @@
<dependency>
<groupId>com.hp.hpl.jena</groupId>
<artifactId>jena</artifactId>
<version>2.6.4</version>
<version>2.6.4</version>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
@ -442,7 +434,7 @@
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
@ -519,6 +511,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.12</version>
</dependency>
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
@ -544,7 +541,6 @@
<artifactId>javax.servlet</artifactId>
<version>3.0.0.v201112011016</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>