浏览代码

Update build code and recover version from POM

Baglio Tabifata 4 年之前
父节点
当前提交
8db160cae3
共有 2 个文件被更改,包括 33 次插入22 次删除
  1. 29 22
      pom.xml
  2. 4 0
      src/main/java/info/hkzlab/dupal/analyzer/App.java

+ 29 - 22
pom.xml

@@ -76,9 +76,35 @@
   </dependencies>
 
   <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>info.hkzlab.dupal.analyzer.App</mainClass>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+              <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+            </manifest>
+          </archive>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+      </plugin>
+    </plugins>
     <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
       <plugins>
-        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->        
         <plugin>
           <artifactId>maven-clean-plugin</artifactId>
           <version>3.1.0</version>
@@ -103,6 +129,8 @@
 					  <archive>
 						  <manifest>
 							  <mainClass>info.hkzlab.dupal.analyzer.App</mainClass>
+                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
 						  </manifest>
 					  </archive>
 				  </configuration>
@@ -124,27 +152,6 @@
           <artifactId>maven-project-info-reports-plugin</artifactId>
           <version>3.0.0</version>
         </plugin>
-        <plugin>
-          <artifactId>maven-assembly-plugin</artifactId>
-          <executions>
-            <execution>
-              <phase>package</phase>
-              <goals>
-                <goal>single</goal>
-              </goals>
-            </execution>
-          </executions>
-          <configuration>
-            <archive>
-              <manifest>
-                <mainClass>info.hkzlab.dupal.analyzer.App</mainClass>
-              </manifest>
-            </archive>
-            <descriptorRefs>
-              <descriptorRef>jar-with-dependencies</descriptorRef>
-            </descriptorRefs>
-          </configuration>
-        </plugin>
       </plugins>
     </pluginManagement>
   </build>

+ 4 - 0
src/main/java/info/hkzlab/dupal/analyzer/App.java

@@ -8,12 +8,16 @@ import info.hkzlab.dupal.analyzer.devices.*;
 public class App {
     private final static Logger logger = LoggerFactory.getLogger(DuPALManager.class);
 
+    private final static String version = App.class.getPackage().getImplementationVersion();
+
     private static String serialDevice = null;
     private static PALSpecs pspecs = null;
     private static int outMask = -1;
     private static String outDir = null;
 
     public static void main(String[] args) throws Exception {
+        System.out.println("DuPAL Analyzer " + version);
+
         if(args.length < 3) {
             logger.error("Wrong number of arguments passed.\n"+
                         "dupal_analyzer <serial_port> <pal_type> <output_dir> [hex_output_mask]\n" +