[ https://issues.apache.org/jira/browse/OPENNLP-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854995#comment-17854995 ]
ASF GitHub Bot commented on OPENNLP-1567: ----------------------------------------- rzo1 commented on code in PR #606: URL: https://github.com/apache/opennlp/pull/606#discussion_r1639507441 ########## opennlp-tools-models/src/main/java/opennlp/tools/models/ClasspathModelFinder.java: ########## @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package opennlp.tools.models; + +import java.net.URI; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +import io.github.classgraph.ClassGraph; Review Comment: Reyling on `java.class.path` property or trying to cast to `URLClassloader` (on the current thread context class loader) is also error prone as not all vendors / classloaders extend it anymore or use the `Class-Path:` property in manifests for Java 9+ module system. Implementing it with pure JDK classes from scratch within OpenNLP and cover all edge cases (like it is done in [Classgraph](https://stackoverflow.com/a/31785767)) might be cumbersome and doesn't add much value just for the sake of reducing transient libs here. What we could do as a compromise is to implement (in an additional PR) some sort of hacky loader/scan alternative which does not cover all edge cases and declare `classgraph` as an **optional** dependency in this module. People, who don't want to use `classgraph` can use the hacky alternative (if it covers their use-case) and people, who need a more sophisticated solution can add `classgraph` as a dependency on their end and have the functionality availble in all edge cases and environments (such as servlet containers, ee containers, quarkus / spring boot envs, etc.) > OpenNLP Models: Provide a Finder / Loader Implementation > -------------------------------------------------------- > > Key: OPENNLP-1567 > URL: https://issues.apache.org/jira/browse/OPENNLP-1567 > Project: OpenNLP > Issue Type: New Feature > Reporter: Richard Zowalla > Assignee: Richard Zowalla > Priority: Major > Fix For: 2.3.4, 2.4.0 > > > as the title says -- This message was sent by Atlassian Jira (v8.20.10#820010)