This guide provides step-by-step instructions for building the Test My Code (TMC) NetBeans plugin from source, including all necessary dependencies and corrections for compatibility with modern Java versions.
- Java 8 JDK (required for building - some components don't work with newer Java)
- Maven 3.x
- NetBeans 27 (or your target NetBeans version)
- Git
- Use Java 8 for building - The TMC projects were designed for Java 8. While you can run NetBeans with Java 21, build the dependencies with Java 8.
- Maven HTTP Blocker - Maven 3.8.1+ blocks HTTP repositories by default. The TMC Maven repository is down, so all dependencies must be built from source.
- Version Compatibility - You'll need to adjust dependency versions in pom.xml files to match what you actually build.
# Install Java 8
sudo apt install openjdk-8-jdk
# Set Java 8 as active for this session
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
# Verify
java -version
javac -versionRemove or disable the HTTP blocker by deleting your Maven settings file:
# Backup existing settings
mv ~/.m2/settings.xml ~/.m2/settings.xml.backup
# Or delete it
rm ~/.m2/settings.xml# Create a working directory
mkdir ~/tmc-build
cd ~/tmc-build
# Clone all dependencies
git clone https://github.com/testmycode/tmc-checkstyle-runner.git
git clone https://github.com/testmycode/tmc-junit-runner.git
git clone https://github.com/testmycode/tmc-langs-abstraction.git
git clone https://github.com/testmycode/tmc-langs.git
git clone https://github.com/testmycode/tmc-core.git
git clone https://github.com/testmycode/tmc-netbeans.gitcd tmc-junit-runner
# Fix Java version compatibility
sed -i 's/1\.7/1.8/g' pom.xml
# Build and install
mvn clean install -DskipTests
cd ..cd tmc-checkstyle-runner
# Fix Java version compatibility
sed -i 's/1\.6/1.8/g' pom.xml
# Build and install
mvn clean install -DskipTests
cd ..cd tmc-langs-abstraction
# Build and install
mvn clean install -DskipTests
cd ..cd tmc-langs
# Skip checkstyle (build-tools dependency issue)
mvn clean install -DskipTests -Dcheckstyle.skip=true
# Note the version that was built
ls ~/.m2/repository/fi/helsinki/cs/tmc/tmc-langs-util/
cd ..IMPORTANT: tmc-core's pom.xml needs version adjustments to match what you actually built.
cd tmc-core
# Check what versions you have in local repository
ls ~/.m2/repository/fi/helsinki/cs/tmc/tmc-langs-util/
ls ~/.m2/repository/fi/helsinki/cs/tmc/tmc-checkstyle-runner/
# Update dependency versions in pom.xml to match
# Example: if tmc-langs-util built as 0.7.1-SNAPSHOT instead of 0.7.16-SNAPSHOT
sed -i 's/0.7.16-SNAPSHOT/0.7.1-SNAPSHOT/g' pom.xml
# Example: if tmc-checkstyle-runner built as 3.0.3-SNAPSHOT instead of 3.0.1
sed -i 's/3.0.1/3.0.3-SNAPSHOT/g' pom.xml
# Verify the changes
grep -A 2 "tmc-langs-util" pom.xml
grep -A 2 "tmc-checkstyle-runner" pom.xml
# Build and install
mvn clean install -DskipTests
cd ..The tmc-netbeans project is NOT a Maven project - it's a NetBeans Ant-based project that must be built within NetBeans IDE.
-
Open NetBeans 27
-
Activate "Developing NetBeans" plugin:
- Go to Tools → Plugins → Installed
- Check the box next to "Developing NetBeans"
- Click Activate
- Restart NetBeans
-
Set up NetBeans Platform (if required):
- Download NetBeans 11.2 "OS Independent Zip"
- Extract it somewhere
- In NetBeans 27: Tools → NetBeans Platforms
- Click Add Platform
- Select the extracted NetBeans 11.2 directory
The plugin has a version check that fails with NetBeans 27. Fix it before building:
cd tmc-netbeans
# Edit the problematic file
nano ./tmc-plugin/src/fi/helsinki/cs/tmc/actions/CheckForOutdatedNetbeans.javaFind the run() method (around line 20-25) and replace it with:
@Override
public void run() {
try {
String version = System.getProperty("netbeans.productversion");
if (version == null || version.length() < 4) {
return; // Skip check for newer NetBeans versions
}
version = version.substring(0, 4);
// rest of existing code...
} catch (Exception e) {
// Ignore version check errors for newer NetBeans
return;
}
}Or simply disable the check entirely by replacing the method body with just return;
-
Open the project:
- In NetBeans 27: File → Open Project
- Navigate to
tmc-netbeansdirectory - Select it and click Open Project
-
Build the project:
- Right-click the project → Clean and Build
- Wait for build to complete
-
Create NBM files:
- Right-click the project → Create NBMs
-
Find the NBM files:
cd ~/tmc-build/tmc-netbeans find . -name "*.nbm" -type f
You should find:
fi-helsinki-cs-tmc.nbm(main plugin)maven-wrapper-*.nbm(dependency)
# Create storage directory
mkdir ~/tmc-netbeans-nbm-files
# Copy NBM files
cd ~/tmc-build/tmc-netbeans
find . -name "*.nbm" -type f -exec cp {} ~/tmc-netbeans-nbm-files/ \;
# Verify
ls -lh ~/tmc-netbeans-nbm-files/-
Open NetBeans 27
-
Go to Tools → Plugins
-
Click the "Downloaded" tab
-
Click "Add Plugins..." button
-
Select BOTH NBM files:
fi-helsinki-cs-tmc.nbmmaven-wrapper-*.nbm
-
Click "Install"
-
Accept any warnings about unsigned plugins
-
Restart NetBeans when prompted
-
Verify installation:
- The TMC menu should appear in the Tools menu
cd ~
tar -czf tmc-netbeans-plugin.tar.gz tmc-netbeans-nbm-files/
# Or create a zip
zip -r tmc-netbeans-plugin.zip tmc-netbeans-nbm-files/Copy the NBM files to other machines and:
- Open NetBeans 27
- Tools → Plugins → Downloaded → Add Plugins...
- Select both NBM files
- Click Install
- Restart NetBeans
Issue: Source option 6/7 is no longer supported
- Solution: Update pom.xml to use Java 8:
sed -i 's/1\.[67]/1.8/g' pom.xml
Issue: Could not find artifact com.sun:tools:jar
- Solution: Use Java 8 for building (tools.jar was removed in Java 9+)
Issue: HTTP blocker preventing dependency resolution
- Solution: Delete
~/.m2/settings.xmland clear cache:rm -rf ~/.m2/repository/fi/ find ~/.m2/repository -name "*.lastUpdated" -type f -delete
Issue: Version mismatch errors during tmc-core build
- Solution: Check what versions were actually built and update pom.xml accordingly
Issue: StringIndexOutOfBoundsException on NetBeans startup
- Solution: Fix the
CheckForOutdatedNetbeans.javafile as described in Step 5.2
When building tmc-core, you'll likely need to adjust these dependencies:
| Dependency | Expected Version | Likely Built Version | How to Fix |
|---|---|---|---|
| tmc-langs-util | 0.7.16-SNAPSHOT | 0.7.1-SNAPSHOT | sed -i 's/0.7.16-SNAPSHOT/0.7.1-SNAPSHOT/g' pom.xml |
| tmc-checkstyle-runner | 3.0.1 | 3.0.3-SNAPSHOT | sed -i 's/3.0.1/3.0.3-SNAPSHOT/g' pom.xml |
Always verify what versions are in ~/.m2/repository/fi/helsinki/cs/tmc/ and adjust accordingly.
- The entire build process takes approximately 30-60 minutes depending on your system
- Keep the NBM files backed up - rebuilding is time-consuming
- The plugin was originally designed for NetBeans 11.x, so some compatibility fixes are necessary for NetBeans 27
- All dependencies must be built with Java 8 due to old API usage (tools.jar, etc.)