Integrate Ceylon in Maven builds.
Here is an example project.
The import-dependency
goal 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>
The compile
and compile-js
goals compile Ceylon modules, for the JVM and JS backends respectively:
<execution> <goals> <goal>compile</goal> </goals> </execution>
-
the default execution phase is
compile
-
the default compiled sources fileset is
${basedir}/src/main/ceylon
-
the default module repository resolves to
target/modules
The sources fileset can be configured:
<execution> <goals> <goal>compile</goal> </goals> <configuration> <sources> <source> <directory>${project.basedir}/src/foo/ceylon</directory> </source> <source> <directory>${project.basedir}/src/bar/ceylon</directory> </source> </sources> </configuration> </execution>
Resources can be added:
<configuration> <resources> <resource> <directory>${project.basedir}/src/resources</directory> </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 resulting modules can be exploded to a specific directory:
<configuration> <explodeTo>target/classes</explodeTo> </configuration>
The verbosity can be configured:
<configuration> <verbose>true</verbose> </configuration>
The run
and run-js
goals run a Ceylon application, for the JVM and JS backends respectively:
<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>
The doc
goal documents a Ceylon:
<execution> <phase>prepare-package</phase> <goals> <goal>goal</goal> </goals> <configuration> <modules> <module>my.module</module> </modules> </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:
Extra user repositories can be added:
<configuration> <userRepos> <userRepo>/path/to/my/module/repo</userRepo> </userRepos> </configuration>
In order to create a project with the ceylon maven plugin using eclipse start by creating the project using a maven wizzard just as you normally would.
Since the default directory for the ceylon source code is ${basedir}/src/main/ceylon
you should create that directory and put
your modules in there unless you changed the default. Then change your pom.xml
according to the instructions at the beggining
of this document. That should be enough for it to work via maven.
In order to make your project work with the Ceylon plugin for Eclipse, first get the Ceylon plugin for Eclipse using the Eclipse market place.
Once you have that plugin right click on your project and click Configure>Convert to Ceylon Project.
Then, if you’re aren’t already in the ceylon perspective get into it by clicking Window>Switch Perspective>Ceylon.
Then in the ceylon explorer, right click on your project and click Build Path>Configure Build Path.
In the window that pops up navigate to Ceylon Build>Build Path. Once you’re there, make sure ${basedir}/src/main/ceylon
is listed as one of the source folders. If it isn’t click add folder and select ${basedir}/src/main/ceylon
.
Then change the output folder at the bottom of the window from target
to target/classes
, click OK.
At this point you can create a module in ${basedir}/src/main/ceylon
using the Ceylon plugin for Eclipse.
You should also be able to run that module.
If you have trouble running the module go to the run configurations and make sure that your module is selected.
Plugin version are named after Ceylon release using an extra number for its own numbering, for example:
-
1.2.0 : first version for Ceylon 1.2.0
-
1.2.0.1 : next version for Ceylon 1.2.0
-
1.2.1 : first version for Ceylon 1.2.1
-
etc…
-
1.2.3 :
-
Repository lookup now looks in the proper folder (
target/modules
) by default -
Becasue of that the
cwd
option could be removed -
Added
compile-js
andrun-js
goals -
Added
explodeTo
option for the compilers
-