Replies: 6 comments 7 replies
-
Hey! I am not too knowledgeable on Maven but I can tell you that the |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for your reply. Yes it's inside a self-contained JAR. I tested it in the (root) "/" and in the "/resources" of the JAR. "/tiled/..." |
Beta Was this translation helpful? Give feedback.
-
I found this: |
Beta Was this translation helpful? Give feedback.
-
I think it's the leading "./" littleKt inserts to the asset(path). See exception above: fun main() {
val path = "tiled/ortho-tiled-world.tmj"
var inStream = ClassLoader.getSystemResourceAsStream(path)
if (inStream == null) {
println("ISSUE: $path")
} else {
println("OK: $path")
}
}
// output:
// OK: tiled/ortho-tiled-world.tmj
// ISSUE: /tiled/ortho-tiled-world.tmj
// ISSUE: ./tiled/ortho-tiled-world.tmj |
Beta Was this translation helpful? Give feedback.
-
@renlite this should now be fixed in #276. I tested with fat JARs, built via gradle, which loaded from it fine. |
Beta Was this translation helpful? Give feedback.
-
I'm not an expert in JVM and Maven: This is my config "pom.xml" to try it with littleKt. I have also tried "Amper Standalone" but at the moment (Version 0.4) there seems not to be a way to pass args (--enable-preview) to the JVM. <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.tiled</groupId>
<artifactId>MyGame</artifactId>
<version>1.0</version>
<properties>
<kotlin.version>2.0.10</kotlin.version>
<kotlin.compiler.jvmTarget>21</kotlin.compiler.jvmTarget>
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<main.class>my/game/TiledKt</main.class>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>com.littlekt</groupId>
<artifactId>core-jvm</artifactId>
<version>0.10.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<testSourceDirectory>${project.basedir}/src</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>my.game.TiledKt</mainClass>
<arguments>
</arguments>
<systemProperties>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals> <goal>single</goal> </goals>
<configuration>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> |
Beta Was this translation helpful? Give feedback.
-
I'm trying littleKt and use Maven as build tool. For "copy-resources" I tried as outputDir:
and get
What is the correct (root) path in the target .jar (File) for resources?
Beta Was this translation helpful? Give feedback.
All reactions