com.github.baev:javassist-classpath-scanner

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

Categories

Categories

Javassist Application Layer Libs Bytecode Manipulation
GroupId

GroupId

com.github.baev
ArtifactId

ArtifactId

javassist-classpath-scanner
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

https://github.com/baev/javassist-classpath-scanner

Download javassist-classpath-scanner

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.baev/javassist-classpath-scanner/ -->
<dependency>
    <groupId>com.github.baev</groupId>
    <artifactId>javassist-classpath-scanner</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.baev/javassist-classpath-scanner/
implementation 'com.github.baev:javassist-classpath-scanner:1.1'
// https://jarcasting.com/artifacts/com.github.baev/javassist-classpath-scanner/
implementation ("com.github.baev:javassist-classpath-scanner:1.1")
'com.github.baev:javassist-classpath-scanner:jar:1.1'
<dependency org="com.github.baev" name="javassist-classpath-scanner" rev="1.1">
  <artifact name="javassist-classpath-scanner" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.baev', module='javassist-classpath-scanner', version='1.1')
)
libraryDependencies += "com.github.baev" % "javassist-classpath-scanner" % "1.1"
[com.github.baev/javassist-classpath-scanner "1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.javassist : javassist jar 3.20.0-GA
org.slf4j : slf4j-api jar 1.7.13

test (5)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3
org.slf4j : slf4j-nop jar 1.7.13
org.zeroturnaround : zt-zip jar 1.8
ru.yandex.qatools.allure : allure-java-annotations jar 1.4.19

Project Modules

There are no modules declared in this project.

Simple classpath scanner for Javassist

release Maven Central build covarage

Lightweight javaassist classpath scanner.

Usage

The artifact avaliable at Maven Central:

<dependency>
	<groupId>com.github.baev</groupId>
	<artifactId>javassist-classpath-scanner</artifactId>
	<version>RELEASE</version>
</dependency>
List<URI> classpath = ...

ClasspathScanner scanner = new ClasspathScanner();
classpath.forEach(scanner::scan);
Set<ClassFile> = scanner.getClasses();

Then you can do whatever you need with the found classes. For example, you can find all the JUnit tests using code like this:

public boolean isTestMethod(MethodInfo methodInfo) {
    return JavassistUtils.isAnnotated(methodInfo, "org.junit.Test");
}

public List<MethodInfo> getTestMethods(ClassFile clazz) {
    return JavassistUtils.getMethods(clazz, this::isTestMethod);
}

List<MethodInfo> testMethods = scanner.getClasses().stream()
    .map(this::getTestMethods)
    .collect(Collectors.toList());

Versions

Version
1.1
1.0