This guide explains how to activate BPJ source transformation so one-argument calls like:
BPJ.print("Hello {user.name}");work correctly without manually passing context.
BPJ has two usage modes:
- Runtime explicit context:
BPJ.print("Hello {user.name}", Map.of("user", user))- Works without build plugin.
- Build-time auto context injection:
BPJ.print("Hello {user.name}")- Requires BPJ Maven or Gradle plugin activation.
If plugin activation is missing, one-argument calls with placeholders can be printed unchanged.
- Java 17+
- BPJ version
0.3.0 - Build with Maven or Gradle (recommended from terminal or delegated build in IDE)
<parent>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-starter-parent</artifactId>
<version>0.3.0</version>
</parent><parent>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-spring-boot-parent</artifactId>
<version>0.3.0</version>
</parent><dependencies>
<dependency>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-maven-plugin</artifactId>
<version>0.3.0</version>
<executions>
<execution>
<goals>
<goal>prepare</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>settings.gradle:
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}build.gradle:
plugins {
id "java"
id "io.github.oriontheprogrammer.bpj" version "0.3.0"
}
repositories {
mavenCentral()
}
dependencies {
implementation "io.github.oriontheprogrammer:bpj:0.3.0"
}buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.github.oriontheprogrammer:bpj-gradle-plugin:0.3.0"
}
}
apply plugin: "java"
apply plugin: "io.github.oriontheprogrammer.bpj"
repositories {
mavenCentral()
}
dependencies {
implementation "io.github.oriontheprogrammer:bpj:0.3.0"
}Run:
mvn clean compileCheck generated transformed sources:
target/generated-sources/bpj
Run:
./gradlew clean compileJavaCheck generated transformed sources:
build/generated/sources/bpj/main
Compile/run code with:
BPJ.println("Hello {user.name}");
BPJ.println("Name method: {user.getName()}");If activation is correct, output resolves values instead of printing placeholders literally.
If you run main() directly from IDE without delegated build, transformation may be skipped.
- IntelliJ IDEA:
- Enable delegated build/run using Maven or Gradle.
- Eclipse/STS:
- Prefer launching through Maven/Gradle tasks.
- VS Code:
- Run project via Maven/Gradle tasks or terminal commands.
Common causes:
- Plugin not configured.
- Build not executed through Maven/Gradle.
- Placeholder root not available in context.
Fix:
- Activate plugin using this guide.
- Build/run from Maven/Gradle.
- Or pass context explicitly.
Check:
personaroot exists in context (or source transformation injected it).- Method has no arguments and is accessible.
Expected behavior:
- Placeholder method calls support only no-arg form (
getName()), not method arguments.
For microservices and team projects:
- Use one of the BPJ parent POMs (or Gradle plugin DSL).
- Keep build delegated to Maven/Gradle in IDE.
- Use one-argument BPJ calls for readability.
- Use explicit context overloads in scripts/small tools where plugin setup is not needed.