为脚本语言设置Maven吗? [英] Setting Maven for scripting languages?

查看:119
本文介绍了为脚本语言设置Maven吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven用于构建和管理任何基于Java的项目.但是,如果项目使用脚本语言,会发生什么?

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

现在所有Maven可以使用TCL进行的工作就是将文件复制到一起,然后将它们放在目标目录的正确位置.

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

我的问题如下:

  1. 代码在TCL中->需要解释器而不是编译器.
  2. 它看不到任何Java代码,因此它不编译任何东西.
  3. 它看不到任何Java测试,因此不会运行它们.
  4. 没有Java可以运行,所以jococo将无事可做.

有什么方法可以设置Maven来支持TCL项目?

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

我在互联网上搜索了很多东西,但只找到了"jacl",但我真的不知道如何使用它来设置Maven.

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.

推荐答案

Tcl与Maven紧密集成(与Java不同),因此您需要做更多的工作.要从Maven运行Tcl脚本,最简单的方法是使用 Exec Maven插件 ,但是您必须将自己绑定到明确的生命周期阶段,而不是依赖默认值.例如,要在test阶段运行脚本(即执行tclsh testscript.tcl anotherArgument),请使用:

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 long不休!不要忘记,您可以将很多复杂性放在父POM中,并且可以使用属性和配置文件来完成有趣的事情.

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.

您还可以使用java目标来运行Jacl或jTcl解释器(在子过程中).这取决于您到底想做什么.

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.

这篇关于为脚本语言设置Maven吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆