At the moment the only solution is to create a shaded jar with an independent maven project and use it as a dependency in the NB module.
It triggers what seems a bug in maven dependencies as some NB modules mix creates a dependency from an [allow] class. For example, adding this dependency in the pom.xml: <dependency> <groupId>org.netbeans.api</groupId> <artifactId>org-apache-tools-ant-module</artifactId> <version>RELEASE126</version> </dependency> And in the class usage there is a "allow" class: Failed to execute goal org.apache.netbeans.utilities:nbm-maven-plugin:4.6:manifest (default-manifest) on project standalone-grpc-module: Uncategorized problems with NetBeans dependency verification (maybe MNBMODULE-102 or wrong maven dependency metadata). Supposedly external classes are used in the project's binaries but the classes are not found on classpath. Class usages: [io.perfmark.Tag, android.annotation.SuppressLint, com.google.gson.stream.JsonToken, allow, io.perfmark.Link, io.perfmark.PerfMark, com.google.gson.stream.JsonReader, org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement] -> [Help 1] Without the dependency: Failed to execute goal org.apache.netbeans.utilities:nbm-maven-plugin:4.6:manifest (default-manifest) on project standalone-grpc-module: Uncategorized problems with NetBeans dependency verification (maybe MNBMODULE-102 or wrong maven dependency metadata). Supposedly external classes are used in the project's binaries but the classes are not found on classpath. Class usages: [io.perfmark.Tag, android.annotation.SuppressLint, com.google.gson.stream.JsonToken, io.perfmark.Link, io.perfmark.PerfMark, com.google.gson.stream.JsonReader, org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement] -> [Help 1] From: Giovanni Dal Maso <dalm...@ttsnetwork.com> Sent: venerdì 10 dicembre 2021 16:21 To: users@netbeans.apache.org Subject: Maven NetBeans Module and gRPC dependencies Hi, a maven based NetBeans Module with GRPC dependencies cannot compile: Steps to reproduce with NetBeans 12.5 or 12.6: 1. Create Maven NetBeans Module 2. Add gRPC dependencies as suggested by gRPC project (https://github.com/grpc/grpc-java#download) 3. Clean & build the module It is also possible to clone my repo (contains only the standalone module): https://github.com/gdm-tts/nbm-grpc The error is missing dependencies verification: while it is possible to add some (e.g. "io.perfmark.Tag") it is not possible to add all dependencies (e.g. "android.annotation.SuppressLint"). Maybe the error should be a warning. Does anybody ever tried to compile NB module with maven and GRPC dependencies? Thanks for any help you can provide in resolving this issue. Output: Scanning for projects... --------------------< test:standalone-grpc-module >--------------------- Building standalone-grpc-module 1.0-SNAPSHOT --------------------------------[ nbm ]--------------------------------- --- maven-clean-plugin:2.5:clean (default-clean) @ standalone-grpc-module --- Deleting C:\tmp\standalone-grpc-module\target --- maven-resources-plugin:3.2.0:resources (default-resources) @ standalone-grpc-module --- Using 'UTF-8' encoding to copy filtered resources. Using 'UTF-8' encoding to copy filtered properties files. Copying 1 resource --- maven-compiler-plugin:3.8.1:compile (default-compile) @ standalone-grpc-module --- Nothing to compile - all classes are up to date --- nbm-maven-plugin:4.6:manifest (default-manifest) @ standalone-grpc-module --- NBM Plugin generates manifest Adding on module's Class-Path: io.grpc:grpc-netty-shaded:jar:1.42.1 com.google.guava:guava:jar:30.1-android com.google.guava:failureaccess:jar:1.0.1 com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava org.checkerframework:checker-compat-qual:jar:2.5.5 com.google.j2objc:j2objc-annotations:jar:1.3 com.google.errorprone:error_prone_annotations:jar:2.9.0 io.grpc:grpc-core:jar:1.42.1 io.grpc:grpc-protobuf:jar:1.42.1 io.grpc:grpc-api:jar:1.42.1 io.grpc:grpc-context:jar:1.42.1 com.google.code.findbugs:jsr305:jar:3.0.2 com.google.protobuf:protobuf-java:jar:3.17.2 com.google.api.grpc:proto-google-common-protos:jar:2.0.1 io.grpc:grpc-protobuf-lite:jar:1.42.1 io.grpc:grpc-stub:jar:1.42.1 ------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 2.340 s Finished at: 2021-12-10T15:40:37+01:00 ------------------------------------------------------------------------ Failed to execute goal org.apache.netbeans.utilities:nbm-maven-plugin:4.6:manifest (default-manifest) on project standalone-grpc-module: Uncategorized problems with NetBeans dependency verification (maybe MNBMODULE-102 or wrong maven dependency metadata). Supposedly external classes are used in the project's binaries but the classes are not found on classpath. Class usages: [io.perfmark.Tag, android.annotation.SuppressLint, com.google.gson.stream.JsonToken, io.perfmark.Link, io.perfmark.PerfMark, com.google.gson.stream.JsonReader, org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement] -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException