diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..041e56b --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,34 @@ +name: Build Java Project + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'adopt' + + - name: Build with Maven + run: | + cd cwaf-ontology + mvn clean package + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: compiled-jar + path: cwaf-ontology/target/*.jar diff --git a/cwaf-ontology/src/main/java/be/uclouvain/service/Parser.java b/cwaf-ontology/src/main/java/be/uclouvain/service/Parser.java index 1e7a934..d76d259 100644 --- a/cwaf-ontology/src/main/java/be/uclouvain/service/Parser.java +++ b/cwaf-ontology/src/main/java/be/uclouvain/service/Parser.java @@ -1,4 +1,5 @@ package be.uclouvain.service; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -358,7 +359,18 @@ public static void main(String[] args) { //ChatGPT - Code Snippet public static List expandPath(String pattern) throws IOException { - Path basePath = Paths.get(pattern).getParent(); + //Path basePath = Paths.get(pattern).getParent(); + + // Extract the directory portion from the pattern + int lastSeparatorIndex = pattern.lastIndexOf(File.separator); + + // Determine the base path based on the last occurrence of the separator + Path basePath; + if (lastSeparatorIndex != -1) { + basePath = Paths.get(pattern.substring(0, lastSeparatorIndex)); + } else { + basePath = Paths.get("."); + } String globPattern = "glob:" + pattern; if (basePath == null) {