简体   繁体   English

是否有类似JET(Java发射器模板)的东西,但是没有Eclipse依赖关系?

[英]Is there something like JET (Java Emitter Templates) but without Eclipse-dependencies?

I wanted to use JET (Java Emitter Templates) in my Netbeans projects, but had to find out that JET heavily depends on Eclipse libraries. 我想在我的Netbeans项目中使用JET(Java发射器模板) ,但是不得不发现JET在很大程度上取决于Eclipse库。

Is there something similar to JET, but as a standalone project? 是否有与JET类似的东西,但作为独立项目?
Something which is open source and well maintained? 哪些是开源的且维护良好的?

Futhermore, is "code generation" the common term for such tools? 此外,“代码生成”是此类工具的通用术语吗?

If you are using Maven, you can use JET templates with the maven-jet-plugin . 如果使用的是Maven,则可以将JET模板与maven-jet-plugin一起使用

This seems to be the source code . 这似乎是源代码 And here the documentation . 还有这里的文档

It is not actively maintained but works pretty well and follows the JET spec. 它没有得到积极维护,但是运行良好,并且遵循JET规范。 I've used it with templates and skeletons. 我已经将其与模板和骨架一起使用了。

It's self contained, doesn't depend on Eclipse, and doesn't introduce any transitive dependencies to your project. 它是自包含的,不依赖Eclipse,也不向项目引入任何可传递的依赖关系。

I ended up using ERB (Ruby's template engine) . 我最终使用了ERB(Ruby的模板引擎)

Works great in Netbeans! 在Netbeans中效果很好!

I define custom ant task which generates source files by calling ERB (whose results are placed inside a non-versioned special directory). 我定义了定制ant任务,该任务通过调用ERB(其结果放置在非版本化的特殊目录中)来生成源文件。

The ant task is overriding Netbeans' "-pre-compile" task. ant任务将覆盖Netbeans的“ -pre-compile”任务。

Indeed JET is very tied with Eclipse. 实际上,JET与Eclipse紧密相关。

If you want to generate code without Eclipse you should use another solution. 如果要在没有Eclipse的情况下生成代码,则应使用其他解决方案。

You can choose another template engine like Velocity ( https://velocity.apache.org/ ) or FreeMarker ( https://freemarker.apache.org/ ). 您可以选择另一个模板引擎,例如Velocityhttps://velocity.apache.org/ )或FreeMarkerhttps://freemarker.apache.org/ )。

Or you can choose a code generator working by itself independently of any IDE. 或者,您可以选择独立于任何IDE独立工作的代码生成器。

For example " Telosys Command Line Interface " : http://www.telosys.org/ 例如“ Telosys命令行界面 ”: http : //www.telosys.org/

From what I know, JET is something like JSP, no? 据我了解,JET类似于JSP,不是吗?

Java Emitter Templates are very similar to Java Server Pages (JSPs). Java Emitter模板与Java Server Pages(JSP)非常相似。 Both JETs and JSPs use the same syntax, and are compiled to Java behind the scenes. JET和JSP都使用相同的语法,并且在后台被编译为Java。 Both are used to separate the responsibility for rendering pages from the model and controller. 两者都用于将呈现页面的责任与模型和控制器分开。 Both accept objects passed into them as an input argument, both allow inserting string values within code ("expressions"), and allow direct use of Java code to perform loops, declare variable, or perform logical flows ("scriptlets"). 两者都接受传递给它们的对象作为输入参数,都允许在代码中插入字符串值(“表达式”),并允许直接使用Java代码执行循环,声明变量或执行逻辑流(“脚本”)。 Both are good ways of representing the structure of a generated object (web page, Java class, or file) while supporting customization of the details. 两种都是表示生成的对象(网页,Java类或文件)的结构的好方法,同时支持细节的自定义。 JETs differ from JSPs in a few key ways. JET在一些关键方面与JSP不同。 In a JET, the structure of the markup may be changed to support generating code in different languages. 在JET中,可以更改标记的结构以支持生成不同语言的代码。 Typically the input to a JET will be a configuration file and not user input (though there is nothing forbidding this). 通常,JET的输入将是配置文件,而不是用户输入(尽管没有禁止这样做的内容)。 And also typically, JET processing will take place only once for a given workflow. 同样通常,对于给定的工作流程,JET处理将仅进行一次。 These are not technical limitations, and you may find uses for JETs which are quite different... 这些不是技术限制,您可能会发现JET的用途大不相同...
ibm.com ibm.com

Here are a few links to get you started on JSP, if that sounds like what you need: 如果听起来像您所需要的,这里有一些链接可以帮助您开始使用JSP:
sun.com sun.com
netbeans.org netbeans.org

Look for "template engine" for these types of tools. 为这些类型的工具寻找“模板引擎”。

A couple you might want to look at: 您可能要看的一对夫妇:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM