Okay, it's pretty easy to instantiate objects in Java through standard reflection. However there are many cases where you need to go beyond what reflection provides. For example, if there's no public constructor, you want to bypass the constructor code, or set final fields. There are numerous clever (but fiddly) approaches to getting around this…
Java HTML Shell CSS Batchfile
Failed to load latest commit information.
.mvn/wrapper Update tools version and add a maven wrapper May 26, 2017
benchmark [maven-release-plugin] prepare for next development iteration Jun 20, 2017
gae Upgrade appengine-maven-plugin to work with Java 9 Oct 11, 2017
main [maven-release-plugin] prepare for next development iteration Jun 20, 2017
tck-android Upgrade android plugin. Now a bit better on Java 9 but not working yet Oct 11, 2017
tck [maven-release-plugin] prepare for next development iteration Jun 20, 2017
website Typo in who.html Jun 20, 2017
.editorconfig Indent at 2 xml and html Jul 25, 2015
.gitattributes Ignore mvn wrapper during archive (close #57) Jun 26, 2017
.gitignore Ignore files generated by maven-release-plugin Aug 16, 2013
.travis.yml Migrate to the new travis platform Jul 20, 2015
Benchmarks.md Typo and grammar Apr 8, 2015
CONTRIBUTING.md Add a contributing agreement Jul 24, 2015
LICENSE.txt Add Apache 2 license to files Jun 17, 2009
README.md Typo in deploy-website.sh script Jun 20, 2017
SupportedJVMs.md Prepare 2.6 Jun 10, 2017
deploy-website.sh Script to deploy the website Aug 3, 2015
deploy.sh Define the ISO date before using it Sep 13, 2017
header.txt EOL with LF Dec 22, 2016
mvnw Update tools version and add a maven wrapper May 26, 2017
mvnw.cmd Update tools version and add a maven wrapper May 26, 2017
objenesis-formatting.xml EOL with LF Dec 22, 2016
pom.xml [maven-release-plugin] prepare for next development iteration Jun 20, 2017
settings-example.xml Remove the list of JVMs and allow to overload the default one Oct 6, 2013



Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is.

You can find the website and user documentation at objenesis.org.

Developer information

Project status

Build Status Maven Central

Environment setup

I'm using:

  • Maven 3.5.0
  • IntelliJ Ultimate 2017.1.3 (thanks to JetBrains for the license) (it should also work with Eclipse)

To configure your local workspace:

  • Import the Maven parent project to Eclipse or IntelliJ
  • Import the Eclipse formatting file objenesis-formatting.xml (usable in Eclipse or IntelliJ)

To build with Maven

There are two different levels of build.

Build without any active profile

It is a basic compilation of the application.

mvn install

Full build

This build will create the source and javadoc jars and run findbugs.

mvn install -Pfull

To run special builds

Run the Android TCK

  • Install the Android SDK
  • Configure a device (real or simulated)
  • Add an ANDROID_HOME to target the Android SDK
  • Add $ANDROID_HOME/platform-tools to your path
  • Activate the debug mode if it's a real device
  • mvn package -Pandroid

Run the benchmarks

mvn package -Pbenchmark
cd benchmark

Generate the website

mvn package -Pwebsite

To update the versions

  • mvn versions:set -DnewVersion=X.Y -Pall
  • mvn versions:commit -Pall if everything is ok, mvn versions:revert -Pall otherwise

Configure to deploy to the Sonatype maven repository

  • You will first need to add something like this to your settings.xml
  • Then follow the instructions from the site below to create your key to sign the deployed items


To check dependencies and plugins versions

mvn versions:display-dependency-updates versions:display-plugin-updates -Pall

To update the license

mvn validate license:format -Pall

To release

  • Add the release notes in website/site/content/notes.html
  • Add these servers to your settings.xml
  • Set gpg_passphrase, bintray_api_key and bintray_user environment variables
  • Launch an Android device (virtual or physical)
  • Launch ./deploy.sh version
  • Answer the questions (normally, just acknowledge the proposed default)
  • Follow the instructions

If something fails and you need to rollback a bit, the following commands might help:

mvn release:rollback -Pall
git tag -d $version
git push origin :refs/tags/$version
git reset --hard HEAD~2

Deploy the website

  • Make sure the pom is at the version you want to release
  • Launch ./deploy-website.sh