Skip to content

Ceylon Maven plugin for compiling/running ceylon from Maven

Notifications You must be signed in to change notification settings

jogardi/ceylon-maven-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ceylon Maven Plugin

Integrate Ceylon in Maven builds.

Either build it or consume it from Sonatype snapshot repository:

In your pom.xml or settings.xml
<pluginRepositories>
  <pluginRepository>
    <id>sonatype-nexus-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
    <layout>default</layout>
    <releases>
      <enabled>false</enabled>
    </releases>
  </pluginRepository>
</pluginRepositories>

Here is an example project.

Usage

The Ceylon cwd (current working directory) is set to ${project.build.directory}, this property can be overriden by setting the ceylon.cwd property affecting any goal of the plugin:

<properties>
  <ceylon.cwd>/path/to/the/cwd</ceylon.cwd>
</properties>

In particular this affects the location modules directory used by the compile, import-dependency and run phases.

This configuration can be overriden in the plugin configuration, either globally or for a particular phase:

<execution>
  <goals>
    <goal>compile</goal>
  </goals>
  <configuration>
    <cwd>/path/to/the/cwd</cwd>
  </configuration>
</execution>

Import Maven dependencies as Ceylon modules

The import-dependency goals imports a Maven dependency in a Ceylon repository:

<execution>
  <goals>
    <goal>import-dependency</goal>
  </goals>
  <configuration>
    <moduleImports>
      <moduleImport>
        <dependency>
          <groupId>org.hamcrest</groupId>
          <artifactId>hamcrest-core</artifactId>
          <version>1.3</version>
        </dependency>
      </moduleImport>
    </moduleImports>
  </configuration>
</execution>
  • the default execution phase is initialize

  • the default imported module name is ${groupId}.${artifactId}/${version}

  • the default module repository resolves to target/modules

An ommited dependency version is resolved from the project dependencies.

The imported module coordinates can be overriden with the name and version:

<configuration>
  <moduleImport>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
    </dependency>
    <name>org.harmcrest.core</name>
    <version>1.3.0</version>
  </moduleImport>
</configuration>

A module descriptor can be provided thanks to the descriptor configuration:

<configuration>
  <moduleImport>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
    </dependency>
    <descriptor>hamcrest.properties</descriptor>
  </moduleImport>
</configuration>

A module import can be forced:

<configuration>
  <moduleImport>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
    </dependency>
    <force>true</force>
  </moduleImport>
</configuration>

The out configuration changes the module output directory:

<configuration>
  <!-- module will be imported in target/mymodules -->
  <out>mymodules</out>
</configuration>

Compile Ceylon modules

The compile goal compiles Ceylon modules:

<execution>
  <goals>
    <goal>compile</goal>
  </goals>
</execution>
  • the default execution phase is compile

  • the default compiled fileset is ${basedir}/src/main/ceylon

  • the default module repository resolves to target/modules

The source fileset can be configured:

<execution>
  <goals>
    <goal>compile</goal>
  </goals>
  <configuration>
    <sources>
      <source>
        <fileset>
          <directory>${project.basedir}/src/foo/ceylon</directory>
        </fileset>
      </source>
      <source>
        <fileset>
          <directory>${project.basedir}/src/bar/ceylon</directory>
        </fileset>
      </source>
    </sources>
  </configuration>
</execution>

Resources can be added:

<configuration>
  <resources>
    <resource>
      <fileset>
        <directory>${project.basedir}/src/resources</directory>
      </fileset>
    </resource>
  </resources>
</configuration>

Extra user repositories can be added:

<configuration>
  <userRepos>
    <userRepo>/path/to/my/module/repo</userRepo>
  </userRepos>
</configuration>

The default output repository can be changed:

<configuration>
  <out>my_modules</out>
</configuration>

Javac options can be passed:

<configuration>
  <javacOptions>-target 8</javacOptions>
</configuration>

The verbosity can be configured:

<configuration>
  <verbose>true</verbose>
</configuration>

Run a Ceylon module

The run goal runs a Ceylon:

<execution>
  <phase>test</phase>
  <goals>
    <goal>run</goal>
  </goals>
  <configuration>
    <module>my.module/1.0.0</module>
  </configuration>
</execution>
  • the goal does not have default execution phase

  • the default module repository resolves to target/modules

Arguments can be passed to the process:

<configuration>
  <arguments>
    <argument>first_arg</argument>
    <argument>second_arg</argument>
  </arguments>
</configuration>

Extra user repositories can be added:

<configuration>
  <userRepos>
    <userRepo>/path/to/my/module/repo</userRepo>
  </userRepos>
</configuration>

The verbosity can be configured:

<configuration>
  <verbose>true</verbose>
</configuration>

Finally the execution can be skipped:

<configuration>
  <skip>true</skip>
</configuration>

Todo

  • test goal

  • import sources jar

  • default module id when classifer != null

  • maybe need to handle dependency scope in importer

  • test external snapshot resolution

About

Ceylon Maven plugin for compiling/running ceylon from Maven

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 79.2%
  • Groovy 16.7%
  • Ceylon 4.1%