问题标签 [exec-maven-plugin]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1882 浏览

bash - 将 bash 参数列表转换为带引号的单个字符串

我正在尝试使用 exec 插件创建一个简单的 bash 脚本来运行带有一些特定参数和“子”参数的 mvn 命令。看起来很简单,但我在达到预期效果时遇到了问题:

这是要运行的命令:

像这样运行时它工作正常,但我想将它包装在一个 bash 脚本中,便于所有人运行:

该脚本将很简单:

但是 "$@" 并没有使它成为一个单引号值,所以我尝试引用它:

我还尝试了第二个脚本,我称为quoter:

这也不起作用,经过很好的组合播放时间,感觉就像我引用它多少次,它仍然将它视为参数列表,第一个元素“-a,然后是第二个元素val1 ,然后是第三个 -b,以此类推。

奇怪的是,如果我不引用引用脚本中的参数,并像这样运行它:

它工作正常,它作为单个参数传递给第二个脚本,然后传递给执行 maven 命令的第一个脚本。

看起来,“$@”并不是一个由所有参数的字符串化连接组成的字符串(如果你考虑一下,这很酷),也不是回显它似乎将它转换为一个(不酷)。有没有办法让这成为可能?

PS:是的,我正在尝试将选项传递给主程序,这是一个严重依赖 Spring 独立应用程序。

0 投票
4 回答
6335 浏览

java - exec-maven-plugin 无法找到或加载主类,但输出在命令行上运行良好

我尝试使用 exec-maven-plugin 来运行 Java 程序。

我使用以下 pom 片段:

该类com.vogella.test.Main包含在位于 /home/vogella/libs/* 中的 jar 文件之一中。如果我运行该mvn -X clean install exec:exec命令,我会看到以下错误消息:

[调试] 执行命令行:java -Dmyproperty=myvalue -cp "/home/vogella/libs/*" com.vogella.test.Main 错误:找不到或加载主类 com.vogella.test.Main

如果我在启动 Maven 构建的 shell 中复制命令行 ( java -Dmyproperty=myvalue -cp "/home/vogella/libs/*" com.vogella.test.Main),则 Java 程序将正确执行。

知道我的 Maven 设置有什么问题吗?

0 投票
2 回答
5876 浏览

exec-maven-plugin - LensKit:无法执行目标 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli)

我正在使用 LensKit 推荐器在 Netbeans 中构建一个 maven 项目,但是当我尝试运行一个 groovy 文件时,我收到以下错误:

我的 POM.xml 包含以下内容

你能提出任何解决方案吗?
如果我需要发布任何其他信息,请告诉我。

更新!
好的,我已经更新了第一条错误消息,下面是异常的堆栈跟踪:

0 投票
1 回答
2754 浏览

java - Caliper test using exec-maven-plugin is saying main method signature isn't valid

I'm trying to get Caliper working with maven, I haven't successfully ran a caliper benchmark test as of yet.

Caliper version: 1.0-beta-1

My benchmark:

My maven pom.xml has:

I ran:

mvn clean install mvn compile -P benchmarks -e -X

0 投票
1 回答
3433 浏览

maven - 读取 config.xml 文件时无法执行目标 org.codehaus.mojo exec-maven-plugin

当我在 Eclipse 中将其作为 java 应用程序运行时,我的代码正在运行,但是当我使用 maven-exec 插件运行 maven install 时它失败了。我知道它失败是因为它没有找到配置文件,但是如何呢?

如果我排除了 maven-exec 插件,它会成功构建,我可以执行我的 jar 文件和依赖项。

这是简化的 DomParser 类

这是 pom.xml

错误在这里:

0 投票
1 回答
3087 浏览

java - 在编译期间在maven中执行一个批处理文件

我正在使用 exec-maven-plugin 使用 maven 执行批处理文件。我让它在打包阶段运行,但我需要它更早运行。编译阶段会很好。

批处理脚本生成一个包含 svn 版本的属性文件。当阶段设置为打包时,它看起来像是在制作war文件后执行此操作。对我来说太晚了。

但是,在eclipse中我得到这个错误:

我的 pom.xml 的相关部分:

首先,exec-maven-plugin 仍然是正确的工具吗?

其次,它可以在比包更早的阶段运行吗?这在任何地方都有记录吗?exec-maven-plugin 项目页面上的邮件列表存档链接已过期。

0 投票
1 回答
627 浏览

java - 在 Windows 下使用 maven exec:java 插件的 JSP 的类路径问题

我正在尝试从main(...)加载一个在运行时加载 JSP 的 Spring Web 上下文运行一个 Jetty Web 框架。mvn exec:java这在 OSX 和 Linux 上使用命令行非常有效。但是在运行 Cygwin 的 Windows 上,我无法让它完全工作。

应用程序加载并且网络上下文似乎构建良好。然而,当第一个 JSP 页面被渲染时,JVM 会即时编译它并抛出以下错误/异常:

在发布之前,我已经进行了大量的网络搜索并尝试了很多事情。

  1. JAVA_HOME变量设置正确。
  2. 我已经确定它指向 JDK 而不是JRE。该tools.jar文件确实存在于%JAVA_HOME%/lib/tools.jar.
  3. JAVA_HOME路径在里面Program Files,我担心空间,但用它替换它Progra~1似乎也不起作用。
  4. 我们已经尝试过mvnCygwin 下的 shell 脚本和mvn.batDOS 下的脚本,但都失败了。

还有其他人有这个问题吗?我是否需要更改classpath以以某种方式专门添加依赖项tools.jar?也许添加了一些东西pom.xml?提前致谢。

0 投票
3 回答
2467 浏览

maven - Maven exec-maven-plugin 和 maven-resources-plugin 没有运行,不知道为什么

pom.xml我在 maven文件中添加了几个新插件。

当我发出命令时,我无法弄清楚为什么exec-maven-plugin并且 maven-resources-plugin它们没有运行:mvn install。其他 Maven 插件确实按预期执行。

当我运行mvn exec:exec时,exec-maven-plugin确实会运行。

我尝试使用许多不同的阶段,但无济于事。

我在这里做错了什么,我应该尝试什么?


这是我的 Maven 文件的相关部分


编辑:

找到了 exec 插件的答案,但还没有找到资源插件的答案。

exec 插件需要一个目标才能触发

添加<goals><goal>exec</goal></goals>到每个<execution>对我来说都是诀窍。

0 投票
1 回答
1712 浏览

maven - Validate phase used twice with exec-maven-plugin associated with process-classes phase

I have a strange behaviour with my Maven build, using the exec-maven-plugin. I note that, even if associated with the process-classes phase, the exec-maven-plugin (using the java goal) regoes through the validate phase.

I can't find any explanation for that, it seems to me it goes against the default build lifecyle.

Here is a part of my pom:

And here are the logs after a mvn package:

As can be seen the [echo] in validate phase (1 of 23) appears twice:

  • one in the "normal" validate phase
  • and an other one in the exec-maven-plugin section, associated with the process-classes phase

If someone has an explanation, it would be greatly appreciated.

0 投票
1 回答
1810 浏览

java - 我如何从 maven pom.xml 文件中获取 Windows 命令提示符命令?

我正在制作一个尝试运行命令提示符命令的 Maven 项目。我尝试了 Exec Maven 插件,但做不到。我认为我对此采取了错误的方式。这是我使用“Exec Maven Plugin”制作文件的工作。有人可以解释为什么这不起作用或对在 pom.xml(不是 Ant)上工作的新插件或解决方案提出建议。

谢谢你..