Maven Plugin
rascal-0.42.1
The rascal-maven-plugin offers these Maven plugins for dealing with Rascal projects:
- Compile Mojo for static checking and compiling Rascal projects.
- Tutor Mojo for generating API docs, and compiling documentation courses.
- Package Mojo for packing compiled Rascal code, source code and documentation into a jar file.
- Exec Mojo for executing arbitrary Rascal code during an arbitrary Maven goal.
- Console Mojo for starting a Rascal REPL
Each of the above is configured in XML in the local pom.xml file of a Rascal project. All of them are executed during a mvn package or mvn install commandline. If the local pom has the right configuration, then each mojo can also be invoked separately:
mvn rascal:compileruns the compiler and-Drascal.compile.skipguarantees it is skipped.mvn rascal:tutorruns the tutor compiler and-Drascal.tutor.skipguarantees it is skipped.mvn rascal:packageruns the package rewriter and-Drascal.package.skipguarantees it is skipped.mvn rascal:execexecutes some Rascal code, while-Drascal.exec.skipmakes sure this goal is skipped.
Examples
This is a typical pom.xml file configuring the rascal-maven-plugin that will provide everything
necessary for a Rascal project, except the Tutor Mojo. This is also the setup that is generated by the New Rascal Project function:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.rascalmpl</groupId>
<artifactId>my-project</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>usethesource</id>
<url>https://releases.usethesource.io/maven/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>usethesource</id>
<url>https://releases.usethesource.io/maven/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal</artifactId>
<version>0.42.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-maven-plugin</artifactId>
<version>0.8.2</version>
<configuration>
<errorsAsWarnings>true</errorsAsWarnings>
<bin>${project.build.outputDirectory}</bin>
<srcs>
<src>${project.basedir}/src/main/rascal</src>
</srcs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Benefits
- Almost zero configuration (due to sensible defaults) for projects that have:
- Rascal source code in
/src/main/rascal - Dependencies listed in
pom.xml<dependency>tags
- Rascal source code in
- When using the Get Project Path Config function from Reflective, and a local
pom.xmlis available, then the produced configuration will be influenced by what is configured in thepom.xmlfile as well. - All dependencies defined in the
pom.xmlare used to automatically configure the library path of the compiler and the interpreter, as well as the classpath of the compiled or interpreted runtime engine. - Rascal projects can depend on any other Maven project