Forráskód Böngészése

Wicth Manifest generation and running all days

Axel Nordh 1 éve
szülő
commit
1a881ffc39
3 módosított fájl, 154 hozzáadás és 135 törlés
  1. 143 128
      Odds/pom.xml
  2. 7 7
      Odds/src/main/Main.java
  3. 4 0
      Odds/src/mysql/Mysql.java

+ 143 - 128
Odds/pom.xml

@@ -1,139 +1,154 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>Odds</groupId>
-  <artifactId>Odds</artifactId>
-  <version>0.0.1-SNAPSHOT</version>
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>Odds</groupId>
+    <artifactId>Odds</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
 
-  <properties>
-    <maven.compiler.source>17</maven.compiler.source>
-    <maven.compiler.target>17</maven.compiler.target>
-    <maven.compiler.release>17</maven.compiler.release>
-  </properties>
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <maven.compiler.release>17</maven.compiler.release>
+    </properties>
 
-  <!-- <packaging>pom</packaging> -->
-  <build>
-    <sourceDirectory>src</sourceDirectory>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.12.1</version>
-        <configuration>
-          <source>17</source>
-          <target>17</target>
-          <release>17</release>
-        </configuration>
-      </plugin>
+    <!-- <packaging>pom</packaging> -->
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.12.1</version>
+                <configuration>
+                    <source>17</source>
+                    <target>17</target>
+                    <release>17</release>
+                </configuration>
+            </plugin>
 
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <version>3.5.1</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>
-                        shade
-              </goal>
-            </goals>
-            <configuration>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>main.Main</mainClass>
-                </transformer>
-              </transformers>
-              <filters>
-                <filter>
-                  <artifact>*:*</artifact>
-                  <excludes>
-                    <exclude>META-INF/*.SF</exclude>
-                    <exclude>META-INF/*.DSA</exclude>
-                    <exclude>META-INF/*.RSA</exclude>
-                  </excludes>
-                </filter>
-              </filters>
-            </configuration>
-          </execution>
-        </executions>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.4.1</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>main.Main</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
 
-      </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>3.5.1</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>
+                                shade
+                            </goal>
+                        </goals>
+                        <configuration>
+                            <transformers>
+                                <transformer
+                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>main.Main</mainClass>
+                                </transformer>
+                            </transformers>
+                            <filters>
+                                <filter>
+                                    <artifact>*:*</artifact>
+                                    <excludes>
+                                        <exclude>META-INF/*.SF</exclude>
+                                        <exclude>META-INF/*.DSA</exclude>
+                                        <exclude>META-INF/*.RSA</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                        </configuration>
+                    </execution>
+                </executions>
 
-      <!--  <plugin>
-          <groupId>org.springframework.boot</groupId>
-          <artifactId>spring-boot-maven-plugin</artifactId>
-          <executions>
-              <execution>
-                  <goals>
-                      <goal>repackage</goal>
-                  </goals>
-                  <configuration>
-                      <classifier>spring-boot</classifier>
-                      <mainClass>
-                        Main
-                      </mainClass>
-                  </configuration>
-              </execution>
-          </executions>
-      </plugin>
--->
-    </plugins>
-  </build>
-  <repositories>
-    <repository>
-      <id>nordhs-repo</id>
-      <name>Nords Repo</name>
-      <url>http://nordh.xyz:9099/repository/nordhs-repo/</url>
-    </repository>
-  </repositories>
-  <dependencies>
-    <!-- https://mvnrepository.com/artifact/org.htmlunit/htmlunit -->
-    <dependency>
-      <groupId>org.htmlunit</groupId>
-      <artifactId>htmlunit</artifactId>
-      <version>4.4.0</version>
-    </dependency>
+            </plugin>
 
-    <dependency>
-      <groupId>com.github.jbytecode</groupId>
-      <artifactId>RCaller</artifactId>
-      <version>3.0</version>
-    </dependency>
-    <dependency>
-      <groupId>com.mysql</groupId>
-      <artifactId>mysql-connector-j</artifactId>
-      <version>9.0.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-maven-plugin</artifactId>
-      <version>3.3.4</version>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>2.18.0</version>
-    </dependency>
-    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
-    <dependency>
-      <groupId>org.seleniumhq.selenium</groupId>
-      <artifactId>selenium-java</artifactId>
-      <version>4.25.0</version>
-    </dependency>
-    <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
+            <!--  <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                        <configuration>
+                            <classifier>spring-boot</classifier>
+                            <mainClass>
+                              Main
+                            </mainClass>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+      -->
+        </plugins>
+    </build>
+    <repositories>
+        <repository>
+            <id>nordhs-repo</id>
+            <name>Nords Repo</name>
+            <url>http://nordh.xyz:9099/repository/nordhs-repo/</url>
+        </repository>
+    </repositories>
+    <dependencies>
+        <!-- https://mvnrepository.com/artifact/org.htmlunit/htmlunit -->
+        <dependency>
+            <groupId>org.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <version>4.4.0</version>
+        </dependency>
 
+        <dependency>
+            <groupId>com.github.jbytecode</groupId>
+            <artifactId>RCaller</artifactId>
+            <version>3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.mysql</groupId>
+            <artifactId>mysql-connector-j</artifactId>
+            <version>9.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-maven-plugin</artifactId>
+            <version>3.3.4</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.18.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
+        <dependency>
+            <groupId>org.seleniumhq.selenium</groupId>
+            <artifactId>selenium-java</artifactId>
+            <version>4.25.0</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
 
-   <!-- <dependency>
-      <groupId>io.github.bonigarcia</groupId>
-      <artifactId>webdrivermanager</artifactId>
-      <version>5.9.2</version>
-    </dependency> -->
-    <dependency>
-      <groupId>com.mysql</groupId>
-      <artifactId>mysql-connector-j</artifactId>
-      <version>9.1.0</version>
-    </dependency>
-  </dependencies>
+
+        <!-- <dependency>
+           <groupId>io.github.bonigarcia</groupId>
+           <artifactId>webdrivermanager</artifactId>
+           <version>5.9.2</version>
+         </dependency> -->
+        <dependency>
+            <groupId>com.mysql</groupId>
+            <artifactId>mysql-connector-j</artifactId>
+            <version>9.1.0</version>
+        </dependency>
+    </dependencies>
 
 </project>

+ 7 - 7
Odds/src/main/Main.java

@@ -50,13 +50,13 @@ public class Main {
         final OddsPortal op = new OddsPortal();
 
         System.out.println("Getting One days ago matches");
-        op.getMatches(LocalDateTime.now().plusDays(-1));
-//        System.out.println("Getting Todays matches");
-//        op.getMatches(LocalDateTime.now().plusDays(0));
-//        System.out.println("Getting Tomorrows matches");
-//        op.getMatches(LocalDateTime.now().plusDays(1));
-//        System.out.println("Getting Next days matches");
-//        op.getMatches(LocalDateTime.now().plusDays(2));
+       op.getMatches(LocalDateTime.now().plusDays(-1));
+        System.out.println("Getting Todays matches");
+        op.getMatches(LocalDateTime.now().plusDays(0));
+        System.out.println("Getting Tomorrows matches");
+        op.getMatches(LocalDateTime.now().plusDays(1));
+        System.out.println("Getting Next days matches");
+        op.getMatches(LocalDateTime.now().plusDays(2));
     }
 
 }

+ 4 - 0
Odds/src/mysql/Mysql.java

@@ -393,6 +393,7 @@ public class Mysql implements Serializable {
     protected Connection getConnection() {
         if (conn == null) {
             try {
+                Class.forName("com.mysql.cj.jdbc.Driver");
                 Properties prop = new Properties();
                 prop.put("user", USERNAME);
                 prop.put("password", PASSWORD);
@@ -400,6 +401,9 @@ public class Mysql implements Serializable {
                 conn = DriverManager.getConnection(URL + DATABASE + TIMEZONE_FIX, prop);
             } catch (final SQLException e) {
                 throw new RuntimeException(e.getMessage(), e);
+            } catch (ClassNotFoundException e) {
+                System.out.println("ClassNotFoundException: " + e.getMessage());
+                throw new RuntimeException(e);
             }
         }
         return conn;