Repository: commons-crypto
Updated Branches:
  refs/heads/master f54e331d4 -> 1a1e3decc


CRYPTO-58: Generate VERSION file using maven resource filtering.

Generating this file using maven resource filtering is less error prone.
Currenlty crypto uses a mix of sources for determining the version
number:
- NativeClassLoader first reads from META-INF and then from VERSION
- Makefile.common only uses the VERSION file

This change makes sure the version number will be set from only one
source, which is maven.


Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/1a1e3dec
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/1a1e3dec
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/1a1e3dec

Branch: refs/heads/master
Commit: 1a1e3decc006bfc75989941ecbe8f772407d96c4
Parents: f54e331
Author: Benedikt Ritter <[email protected]>
Authored: Tue May 10 09:53:45 2016 +0200
Committer: Dapeng Sun <[email protected]>
Committed: Sat May 21 12:12:45 2016 +0800

----------------------------------------------------------------------
 Makefile.common                                 |  2 +-
 pom.xml                                         | 20 ++++++++++++++++++++
 src/main/java/org/apache/commons/crypto/VERSION | 17 -----------------
 .../resources/org/apache/commons/crypto/VERSION | 17 +++++++++++++++++
 4 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/1a1e3dec/Makefile.common
----------------------------------------------------------------------
diff --git a/Makefile.common b/Makefile.common
index f7a4674..8109df7 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -18,7 +18,7 @@
 TARGET:=target
 SRC:=src/main/java
 SRC_NATIVE:=src/main/native
-include $(SRC)/org/apache/commons/crypto/VERSION
+include $(TARGET)/classes/org/apache/commons/crypto/VERSION
 
 ifndef JAVA_HOME
 $(error Set JAVA_HOME environment variable)

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/1a1e3dec/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5526160..57123c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -287,6 +287,12 @@ Features
   </licenses>
 
   <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources/</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
     <pluginManagement>
       <plugins>
         <plugin>
@@ -315,6 +321,20 @@ Features
     </pluginManagement>
     <plugins>
       <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.7</version>
+        <executions>
+          <execution>
+            <id>create-version-file</id>
+            <!-- change phase of maven-resource-plugin -->
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/1a1e3dec/src/main/java/org/apache/commons/crypto/VERSION
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/VERSION 
b/src/main/java/org/apache/commons/crypto/VERSION
deleted file mode 100644
index 554d49f..0000000
--- a/src/main/java/org/apache/commons/crypto/VERSION
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-VERSION=1.0.0-SNAPSHOT

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/1a1e3dec/src/main/resources/org/apache/commons/crypto/VERSION
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/commons/crypto/VERSION 
b/src/main/resources/org/apache/commons/crypto/VERSION
new file mode 100644
index 0000000..e7fe706
--- /dev/null
+++ b/src/main/resources/org/apache/commons/crypto/VERSION
@@ -0,0 +1,17 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+VERSION=${project.version}

Reply via email to