Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflections not longer maintained, needs to be removed or replaced #1624

Closed
tfr42 opened this issue Jan 9, 2024 · 3 comments · Fixed by #1642
Closed

Reflections not longer maintained, needs to be removed or replaced #1624

tfr42 opened this issue Jan 9, 2024 · 3 comments · Fixed by #1642
Labels
core deegree core modules dependencies Pull requests that update a dependency (library) TMC discussion to be discussed by technical management committee members
Milestone

Comments

@tfr42
Copy link
Member

tfr42 commented Jan 9, 2024

The project has a compile-time dependency to

<dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
    </dependency>

Usage:

The project https://github.com/ronmamo/reflections is not longer maintained and doesn't support new Jakarta EE 9+ API. This dependency needs to be removed or replaced.

@tfr42 tfr42 added TMC discussion to be discussed by technical management committee members dependencies Pull requests that update a dependency (library) core deegree core modules labels Jan 9, 2024
@tfr42 tfr42 added this to the 3.6 milestone Jan 9, 2024
@tfr42
Copy link
Member Author

tfr42 commented Jan 9, 2024

relates to #1401

@tfr42
Copy link
Member Author

tfr42 commented Jan 10, 2024

The @Tool annotation is used in the following CLIs documented in #1386

@stephanr
Copy link
Member

The org.reflections:reflections from OGCFrontController is related to the extraction of maven build information.

  • ConfigurationBuilder builder = new ConfigurationBuilder();
    builder = builder.setUrls(classpathURL);
    builder = builder.setScanners(new ResourcesScanner());
    Reflections r = new Reflections(builder);
    Set<String> resources = r.getResources(Pattern.compile("(MANIFEST\\.MF)"));
    if (!resources.isEmpty()) {
    URLClassLoader classLoader = new URLClassLoader(new URL[] { classpathURL }, null);
    String resourcePath = resources.iterator().next();
    InputStream buildInfoStream = null;
    try {
    Properties props = new Properties();
    buildInfoStream = classLoader.getResourceAsStream(resourcePath);
    props.load(buildInfoStream);
    String buildArtifactId = props.getProperty("deegree-build-artifactId",
    props.getProperty("build.artifactId"));
    if (buildArtifactId == null) {
    // skipping because this jar is not from deegree
    return null;
    }
    String buildBy = props.getProperty("deegree-build-by", props.getProperty("build.by"));
    String buildDate = props.getProperty("deegree-build-date", props.getProperty("build.date"));
    String buildRev = props.getProperty("deegree-build-rev", props.getProperty("build.svnrev"));
    String version = retrieveVersion(props, r, classLoader, buildArtifactId, classpathURL);
    return new ModuleInfo(buildArtifactId, version, buildRev, buildDate, buildBy);
    }
    finally {
    closeQuietly(buildInfoStream);
    }
    }
    return null;

In general, I would suggest removing the dependency on org.reflections:reflections.
The question remains whether we want to continue to retrieve build information from the deegree modules (jar) or not.

If we decide to keep these build information, an alternative could be to use java ServiceLoader:

  • Add a centralized Helper class using ServiceLoader to load all known subclasses
  • Define an abstract class containing the loading capabilities that require a class/class loader reference
  • Inject a dummy class in each module/jar implementing the abstract class which provides a local class/class loader reference
  • Define a service in each module/jar to this implementation (META-INF/services/xxxx)

tfr42 added a commit to lat-lon/deegree3 that referenced this issue Jan 10, 2024
…, Version 2.0) into class to resolve type incompatibility after migration from javax. to jakarta.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core deegree core modules dependencies Pull requests that update a dependency (library) TMC discussion to be discussed by technical management committee members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants