groovy dependencies { } package com.example.utils; public class StringUtils { public static String reverse(String str) { return new StringBuilder(str).reverse().toString(); } } plaintext -name: Utils -version: 1.0.0 -buildpath: osgi.core, osgi.annotation -privatepackage: com.example.utils -exportpackage: com.example.utils shell bnd build groovy dependencies { implementation files('path/to/generated/utils.jar') } import com.example.utils.StringUtils; public class Main { public static void main(String[] args) { String str = "Hello World"; String reversedStr = StringUtils.reverse(str); System.out.println(reversedStr); } }


上一篇:
下一篇:
切换中文