CompileInfo
This Java library contains the CompileInfo annotation which provides a convenient way to get access to information that was available at compile-time.
More specifically it is an annotation processor that captures the time and system properties at compile time and stores them in a generated Java class. This is helpful for devops purposes, like in a delivery pipeline. It allows developers, operations and testers to know exactly when and where an application was built, if these properties are exposed by the application at runtime.
Usage
You will need to include compileinfo-${version}.jar
in your build.
Usage with Maven:
In a Maven project, one would include the net.q2ek:compileinfo
artifact as a provided
dependency:
<dependency>
<groupId>net.q2ek</groupId>
<artifactId>compileinfo</artifactId>
<version>1.0.0-rc1</version>
<scope>provided</scope>
</dependency>
IDE support
To support annotation processing in your IDE see: https://immutables.github.io/apt.html
Examples
Example of typical basic usage:
import net.q2ek.compileinfo.CompileInfo;
@CompileInfo
class FirstExample {
public String compileDateTime() {
return FirstExampleCompileInfo.zonedDateTime().toString();
}
public String jenkinsBuildUrl() {
return FirstExampleCompileInfo.getenv().get("BUILD_URL");
}
}
All examples:
See example_output.md for the generated classes for these examples.
API
See API.md for the API description.
Built with
- AutoService - Google Auto Service
- Maven - Dependency Management and the project is a standard Maven project.
Releases
See RELEASES.md for a list of the release history.
Authors
License
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details.