Commit 9704dee0 authored by Robert Butora's avatar Robert Butora
Browse files

mvn build: tagets java version to 1.7, runs on /etc/alternatives/javac, uses git-version

parent 8c13b1f8
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
#!/bin/bash


JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.9.0.9-3.fc38.x86_64 mvn clean package


VERSION=$(git describe)
echo "class Version { static String asString = \"${VERSION}\";}" > src/main/java/webapi/Version.java
mvn package


#JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.9.0.9-3.fc38.x86_64 mvn  package

# java show class version:
# find . -name "*.class" -exec file -b {} \; | awk -F',' '{print $NF}' | sort -u
+27 −14
Original line number Original line Diff line number Diff line
@@ -12,8 +12,8 @@
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
          <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
          <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
          <!-- FIXME needs JAVA_HOME=/usr/java/jdk-17.0.4.1 (java17 manually installed and aletrnatives activated) -->
          <!-- FIXME needs JAVA_HOME=/usr/java/jdk-17.0.4.1 (java17 manually installed and aletrnatives activated) -->
          <maven.compiler.source>17</maven.compiler.source>
          <maven.compiler.source>7</maven.compiler.source>
          <maven.compiler.target>17</maven.compiler.target>
          <maven.compiler.target>7</maven.compiler.target>
  </properties>
  </properties>




@@ -40,7 +40,6 @@
                  <groupId>vo</groupId>
                  <groupId>vo</groupId>
                  <artifactId>vlkb-volib</artifactId>
                  <artifactId>vlkb-volib</artifactId>
                  <version>0.9.1</version>
                  <version>0.9.1</version>
                  <!-- scope>provided</scope -->
          </dependency>
          </dependency>


          <dependency>
          <dependency>
@@ -61,6 +60,7 @@
                  <artifactId>jackson-core</artifactId>
                  <artifactId>jackson-core</artifactId>
                  <version>2.15.1</version>
                  <version>2.15.1</version>
          </dependency>
          </dependency>

          <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
          <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
          <dependency>
          <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <groupId>com.fasterxml.jackson.core</groupId>
@@ -74,6 +74,7 @@
                  <artifactId>slf4j-api</artifactId>
                  <artifactId>slf4j-api</artifactId>
                  <version>1.7.36</version>
                  <version>1.7.36</version>
          </dependency>
          </dependency>

          <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
          <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
          <dependency>
          <dependency>
                  <groupId>org.slf4j</groupId>
                  <groupId>org.slf4j</groupId>
@@ -89,6 +90,7 @@
                  <version>1.4.7</version>
                  <version>1.4.7</version>
                  <scope>test</scope>
                  <scope>test</scope>
          </dependency>
          </dependency>

          <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
          <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
          <dependency>
          <dependency>
                  <groupId>ch.qos.logback</groupId>
                  <groupId>ch.qos.logback</groupId>
@@ -110,10 +112,11 @@
                  <scope>provided</scope>
                  <scope>provided</scope>
          </dependency>
          </dependency>


          <!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
          <dependency>
          <dependency>
                  <groupId>org.apache.clerezza.ext</groupId>
                  <groupId>com.googlecode.json-simple</groupId>
                  <artifactId>org.json.simple</artifactId>
                  <artifactId>json-simple</artifactId>
                  <version>0.4</version>
                  <version>1.1</version>
          </dependency>
          </dependency>


          <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
          <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
@@ -130,13 +133,6 @@
                  <version>0.11.5</version>
                  <version>0.11.5</version>
          </dependency>
          </dependency>


          <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
          <dependency>
                  <groupId>org.postgresql</groupId>
                  <artifactId>postgresql</artifactId>
                  <version>42.2.5</version>
          </dependency>

          <dependency>
          <dependency>
                  <groupId>junit</groupId>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <artifactId>junit</artifactId>
@@ -147,8 +143,22 @@
  </dependencies>
  </dependencies>


  <build>
  <build>
          <finalName>vlkb-siav2</finalName>
          <finalName>${project.artifactId}-${git.buildnumber}</finalName>
          <plugins>
          <plugins>
                  <plugin>
                          <groupId>ru.concerteza.buildnumber</groupId>
                          <artifactId>maven-jgit-buildnumber-plugin</artifactId>
                          <version>1.2.7</version>
                          <executions>
                                  <execution>
                                          <id>git-buildnumber</id>
                                          <goals>
                                                  <goal>extract-buildnumber</goal>
                                          </goals>
                                          <phase>prepare-package</phase>
                                  </execution>
                          </executions>
                  </plugin>
                  <plugin>
                  <plugin>
                          <artifactId>maven-war-plugin</artifactId>
                          <artifactId>maven-war-plugin</artifactId>
                          <version>3.3.2</version>
                          <version>3.3.2</version>
@@ -157,6 +167,9 @@
                          <artifactId>maven-compiler-plugin</artifactId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>3.8.1</version>
                          <version>3.8.1</version>
                          <configuration>
                          <configuration>
                                  <!-- verbose>true</verbose -->
                                  <fork>true</fork>
                                  <executable>/etc/alternatives/javac</executable>
                                  <compilerArgument>-Xlint:unchecked</compilerArgument>
                                  <compilerArgument>-Xlint:unchecked</compilerArgument>
                          </configuration>
                          </configuration>
                  </plugin>
                  </plugin>