මම මේ forum එකට වගේම java වලට අලුත් - beginner කෙනෙක්. මම පොඩි Java GUI application project එකක් develop කරමින් ඉන්නේ Netbeans IDE එකේ. sqlite-jdbc driver එක පාවිච්චි කරලා පොඩි database connection එහෙකුත් හදලා තියෙන්නෙ. ඔය link එකේ කියලා තියෙන විදිහට සේරම jar files ටිකත් dependencies විදිහට add කරා. IDE එකේ app එක normally run කරාම errors නැතුව ලස්සනට run වෙනවා. හැබැයි, මං ඒක clean/build කරාම හැදෙන jar file එක run වෙන්නේ නෑ. Console through run කරාම ඔය title එකේ තියෙන error එක එනවා.
Internet search කරා සෑහෙන්න, විසඳුමක් ලැබුණේ නෑ. sqlite-jdbc එකේ කියලා තියෙනවා pom file එකට transformer tag එක යටතේ පොඩි code snippet එකක් දාන්න කියලා. ඒකත් දැම්මා (file එකේ දාන්න ඕනි තැන හරියටම sure නෑ, compile errors එන්නෙ නැති තැනකට තෝරලා දැම්මා), ඒත් හරිගියේ නෑ.
දන්න කෙනෙක් ඉන්නවනං මේකට විසඳුමක් දෙන්න පුලුවන් ද? මං මගේ project structure එකේ screenshot එකක් සහ pom source file එකයි මෙතන attach කරන්නං.
Issue resolved. pom file එකේ වෙනසක් කරා. මං කරපු වෙනස රතු පාටින් තියෙනවා. කලින් මං ඒක build කරද්දි dependency jar files ටික මගේ jar file binaries වලට include
වෙන විදිහට නෙමේ දාලා තිබිලා තියෙන්නෙ. එහෙම උනාම ඒ dependency jar files ටිකත් මගේ application jar file එක තඉයෙන folder එකේම තියන්න වෙනවා. අර රතු පාටින් තියෙන කොටස දැම්මම අර dependency jar files ටිකත් මගේ application එකේ jar file එක ඇතුළට include වෙලා build වෙනවා.
Internet search කරා සෑහෙන්න, විසඳුමක් ලැබුණේ නෑ. sqlite-jdbc එකේ කියලා තියෙනවා pom file එකට transformer tag එක යටතේ පොඩි code snippet එකක් දාන්න කියලා. ඒකත් දැම්මා (file එකේ දාන්න ඕනි තැන හරියටම sure නෑ, compile errors එන්නෙ නැති තැනකට තෝරලා දැම්මා), ඒත් හරිගියේ නෑ.
දන්න කෙනෙක් ඉන්නවනං මේකට විසඳුමක් දෙන්න පුලුවන් ද? මං මගේ project structure එකේ screenshot එකක් සහ pom source file එකයි මෙතන attach කරන්නං.
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>Scheduler</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<exec.mainClass>com.mycompany.scheduler.Scheduler</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>com.github.lgooddatepicker</groupId>
<artifactId>LGoodDatePicker</artifactId>
<version>11.2.1</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.44.1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>2.0.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>Dependencies/</classpathPrefix>
<mainClass>com.mycompany.scheduler.Scheduler</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Issue resolved. pom file එකේ වෙනසක් කරා. මං කරපු වෙනස රතු පාටින් තියෙනවා. කලින් මං ඒක build කරද්දි dependency jar files ටික මගේ jar file binaries වලට include
වෙන විදිහට නෙමේ දාලා තිබිලා තියෙන්නෙ. එහෙම උනාම ඒ dependency jar files ටිකත් මගේ application jar file එක තඉයෙන folder එකේම තියන්න වෙනවා. අර රතු පාටින් තියෙන කොටස දැම්මම අර dependency jar files ටිකත් මගේ application එකේ jar file එක ඇතුළට include වෙලා build වෙනවා.
------ Post added on Jan 15, 2024 at 1:19 PM<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>Scheduler</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<exec.mainClass>com.mycompany.scheduler.Scheduler</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>com.github.lgooddatepicker</groupId>
<artifactId>LGoodDatePicker</artifactId>
<version>11.2.1</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.44.1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>2.0.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--<classpathPrefix>\lib</classpathPrefix>-->
<mainClass>com.mycompany.scheduler.Scheduler</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs> <!--
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
</transformers> -->
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>