maventclpom.xmljacl

Setting Maven for scripting languages?


Maven is for building and managing any Java-based project. But what happens if a project is in a scripting language?

All maven can do now with TCL is copy the files around and put them in the right place in the target directory.

My problems are as follows:

  1. Code is in TCL-> need of an interpreter not of a compiler.
  2. It doesn't see any Java code, so it doesn't compile anything.
  3. It doesn't see any Java tests, so it doesn't run them.
  4. There's no java to run coverage against, so the jococo won't have anything to do.

Is there any way to set up maven for supporting a TCL project?

I've searched a lot in the internet and I found only 'jacl', but I don't really know how I can use it for setting up Maven.


Solution

  • Tcl isn't closely integrated with Maven (unlike Java) so you'll have to do more work. To run a Tcl script from Maven, the simplest way is to use the Exec Maven Plugin, but you have to bind the executions to explicit lifecycle phases yourself instead of relying on defaults. For example, to run a script during the test phase (i.e., to do tclsh testscript.tcl anotherArgument), you use:

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run-tcl-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>tclsh</executable>
                            <arguments>
                                <argument>testscript.tcl</argument>
                                <argument>anotherArgument</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    Maven's long-winded! Don't forget that you can probably put much of the complexity in a parent POM, and you can use properties and profiles to do interesting things.

    You can also use the java goal to run Jacl or jTcl interpreters (in a sub-process). It depends on what exactly you want to do.