You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Abacn (via GitHub)" <gi...@apache.org> on 2025/01/02 16:26:17 UTC

Re: [PR] Make Beam expansion service shadowJar multi-release [beam]

Abacn commented on PR #33472:
URL: https://github.com/apache/beam/pull/33472#issuecomment-2568038477

   Yeah I think it's working. To test,
   
   Creating a gradle project:
   
   ```
   plugins {
       id 'java'
       id("com.github.johnrengelman.shadow") version "7.1.1"
   }
   
   repositories {
       mavenCentral()
       mavenLocal()
       maven {
           url 'https://repository.apache.org/content/groups/snapshots'
       }
   }
   
   dependencies {
       implementation("org.apache.beam:beam-sdks-java-io-expansion-service:2.63.0-SNAPSHOT")
   }
   
   def javaMainClass = "com.github.abacn.InspectClass"
   
   task exec(type: Exec) {
       dependsOn build
       group = "Execution"
       description = "Run the main class with ExecTask"
       commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass
   }
   ```
   
   with a main class:
   
   ```
   package com.github.abacn;
   
   public class InspectClass {
     public static void main(String[] argv) throws ClassNotFoundException {
       String name = "org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider";
       Class<?> clz = Class.forName(name);
       String path = clz.getProtectionDomain().getCodeSource().getLocation().getPath();
       System.out.println(name + ": " + path);
     }
   }
   ```
   
   ----
   
   Run with Java 21.
   
   Before (run on nightly):
   
   ```
   > Task :shadowPluginTest:exec FAILED
   Exception in thread "main" java.lang.ClassNotFoundException: org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider
           at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
           at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
   ```
   
   After:
   
   ```
   > Task :shadowPluginTest:exec
   org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider: /Users/yathu/.m2/repository/org/apache/beam/beam-sdks-java-io-expansion-service/2.63.0-SNAPSHOT/beam-sdks-java-io-expansion-service-2.63.0-SNAPSHOT.jar
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org