JaMoPP is an EMF-based tool that can parse and print Java source and byte code into EMF models and vice versa. It preserves source formatting and can be used for code analysis, refactoring, and code generation. JaMoPP is based on the original version by DevBoost GmbH and the Software Technology Group of the Technical University of Dresden. It has been forked by the Institute of Information Security and Dependability (KASTEL) at the Karlsruhe Institute of Technology (KIT). This repository is not supported by or affiliated with DevBoost GmbH or TU Dresden (TUD).
JaMoPP defines a complete metamodel and textual syntax specification for Java, covering Java versions up to 15. It also provides a parser and printer that can convert between text and models in both directions. This allows Java code to be treated like any other model. JaMoPP can also parse and print byte code (.class
files) using the Eclipse Java Development Tools (JDT).
For more information read the original publications: JaMoPP publications
Currently, JaMoPP only supports a direct inclusion of its sources into Eclipse. For stand-alone usage, use the code in jamopp.standalone.JaMoPPStandalone.java
as a starting point.
- Eclipse Modeling Tools 2022-09 with UTF-8 encoding and (optionally) install Xtext from the Marketplace
- Java 17
- Maven 3.8.7
JaMoPP can be installed from its update site (latest build from master), or the plugins can be imported directly into Eclipse:
- Clone this repository.
- Import all existing plugins from this repository (In Eclipse click
File -> Import
and selectGeneral -> Existing Projects into Workspace
). - Set
releng/org.palladiosimulator.jdt.targetplatform/org.palladiosimulator.jdt.targetplatform.target
as the active target platform. - Run the
generate.mwe2
file inreleng/org.palladiosimulator.jdt.workflow/workflow/
(if Xtext is installed). Alternatively, run a build (e.g.mvn clean verify
) that also generates the model code. - Now you should be able to use JaMoPP. Note: The file encoding must be set to UTF-8. Otherwise compilation errors may occur.
- To test the setup, open the console in root folder and build project with
mvn clean verify
. All tests will be run with the build.
In Eclipse, after installing JaMoPP, you can load Java files (.java
and .class
files) with any EMF-based tool similar to how you load other EMF models.
For stand-alone usage, use the code in JaMoPPStandalone.java as a starting point. The JaMoPPStandalone class is a standalone utility for parsing Java source code and generating XMI models. It can be used to parse any URI (absolute or relative file path/ Directory/ Archive) and output the corresponding XMI model. The class takes two input parameters:
INPUT
: The URI of the Java source code to parse.ENABLE_OUTPUT_OF_LIBRARY_FILES
: A Boolean flag that determines whether to output XMI models for library files. The class generates XMI models for the Java source code and saves them to the ./standalone_output directory. The directory structure of the output files mirrors the package hierarchy of the Java source code.
- Eclipse Tycho
- Maven
- Google Guice - Used for the bundles
/tools.mdsd.jamopp.printer
and/tools.mdsd.jamopp.parser
. The code responsible for the dependency injection are in theinjection
packages.
For styling and coding conventions the Eclipse internal compiler, Eclipse-PMD, SpotBugs and Teamscale are used.
- The PMD ruleset is
JaMoPP\codestyle\jamopp-ruleset.xml
. - The Teamscale analysis profile is
JaMoPP\codestyle\Jamopp-Profile.tsanalysisprofile
. - The Spotbugs exclude file is
JaMoPP\codestyle\jamopp-exclude-filter.xml
.
The settings for the plugins and for the internal compiler are all saved as project settings and should be imported when the repository is opened in Eclipse. Spotbugs and PMD must be downloaded from the Eclipse Marketplace.
We tested JaMoPP with the following evaluation scenarios:
- acmeair/acmeair apache/commons-lang
- berndruecker/flowing-retail
- bigbluebutton/bigbluebutton
- connorimes/SPECjvm2008
- sluluyao/SPECjbb2005
- DescartesResearch/TeaStore
- eventuate-tram/eventuate-tram-examples-customers-and-orders-redis
- ewolff/microservice-kafka
- ewolff/microservice
- h2database/h2database
- jonashackt/spring-rabbitmq-messaging-microservices
- kbastani/spring-cloud-event-sourcing-example
- kit-sdq/esda
- kit-sdq/TimeSheetGenerator
- meet-eat/meet-eat-data
- meet-eat/meet-eat-server
- nickboucher/trojan-source
- PalladioSimulator/Palladio-Addons-PlantUML
- PalladioSimulator/Palladio-Build-DependencyTool
- petros94/smart-home-websockets
- sguazt/RUBiS
- sjwoodman/clnr-demo
- spring-io/sagan
- spring-petclinic/spring-petclinic-microservices
- sqshq/piggymetrics
- TeamatesProject/teammates
We welcome contributions to JaMoPP. Please submit pull requests to the GitHub repository.
JaMoPP is released under the Eclipse Public License - v 1.0. For more information, please refer to the LICENSE file.