使用gradle时无法推断groovy类路径(Cannot infer groovy classpath when using gradle)
我有一个简单的Gradle项目:
apply plugin: 'groovy' apply plugin: 'application' mainClassName = 'HelloWorld'
在
src/main/groovy
有一个Groovy源文件:public class HelloWorld { public static void main(String[] args) { print "hello world" } }
我输入
gradle run
并得到以下错误:FAILURE: Build failed with an exception. * What went wrong: Cannot infer Groovy class path because no Groovy Jar was found on class path: [/Users/jzwolak/files/experimenting/gradle/groovy-project/build/classes/java/main] * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED in 0s 1 actionable task: 1 executed
我如何配置Gradle的Groovy类路径?
我有Groovy在
/usr/local/opt/groovy/libexec/
I have a trivial Gradle project:
apply plugin: 'groovy' apply plugin: 'application' mainClassName = 'HelloWorld'
With one Groovy source file in
src/main/groovy
:public class HelloWorld { public static void main(String[] args) { print "hello world" } }
I type
gradle run
and get the following error:FAILURE: Build failed with an exception. * What went wrong: Cannot infer Groovy class path because no Groovy Jar was found on class path: [/Users/jzwolak/files/experimenting/gradle/groovy-project/build/classes/java/main] * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED in 0s 1 actionable task: 1 executed
How do I configure the Groovy classpath for Gradle?
I have Groovy at
/usr/local/opt/groovy/libexec/
原文:https://stackoverflow.com/questions/49120352
更新时间:2022-01-22 14:01
最满意答案
你也可以用perl来做:
perl -F"|" -ane 'BEGIN{$f=0}if(/Rice/){print;$f=1}END{print "not found\n" unless($f)}' your_file
you can also do it in perl:
perl -F"|" -ane 'BEGIN{$f=0}if(/Rice/){print;$f=1}END{print "not found\n" unless($f)}' your_file
相关问答
更多-
启动进程Java时,必须在填充之前读取错误和输入流。 它在Linux / OS X下并不是什么大问题,但在Windows下,JVM和子进程之间的缓冲区非常小,如果你不立即开始阅读,程序将会挂起。 看起来代码正在为输入流而不是错误流执行此操作,因此如果来自del的确认来自错误流,那么这将足以挂起进程。 Java中有一种方法可以组合输出和错误流。 最简单的方法是在创建进程时使用ProcessBuilder.redirectErrorStream() 。 代码的另一个可能问题是使用readLine(). 如果子程 ...
-
试试这个,它对我有用而没有任何错误: @echo off &setlocal :COMMANDLOOP echo. set "TEMPCMD=%CD%" set /P "TEMPCMD=%CD% :" IF "%TEMPCMD%"=="QUIT" (GOTO END2 ) else ( if "%TEMPCMD%"=="FRHELP" ( GOTO COMMANDSLIST ) else ( GOTO COMMANDLOOP ) ) pause ...
-
MS DOS命令提示符 - 在一个命令中提供多个输入文件名(MS DOS Command Prompt - Providing several input file names in one command)[2023-04-25]
我相信你正在追求所谓的“管道”。 一个程序的输出被输入另一个程序的输入。 这在一个命令行中表示。 例如, dir生成一系列行并对行进行排序,对它们进行排序并将它们写出来。 所以, dir | sort 您可以根据需要随意组合多个程序并传递他们需要的任何参数。 dir | find "2013" | sort 编辑:根据您的评论更新。 如果第二个程序只读取第一个程序的输出,那么你就可以这样做。 first你也可以用perl来做: perl -F"|" -ane 'BEGIN{$f=0}if(/Rice/){print;$f=1}END{print "not found\n" unless($f)}' your_file you can also do it in perl: perl -F"|" -ane 'BEGIN{$f=0}if(/Rice/){print;$f=1}END{print "not found\n" unless($f)}' your_file我假设您正在使用getRuntime().exec()来执行? 如果是这样,它返回的Process对象将允许您访问您执行的命令的输入/输出流。 只需从中读取并编写自己的文件即可。 - 根据评论进行编辑 - 从"cmd.exe /c start " + command会在一个单独的窗口中启动程序,我猜这个进程的流程都附加到该窗口。 C:\Users\z000dgqd>start /? Starts a separate window to run a specified program or command. ...使用输入和输出文件通过命令提示符运行Java程序(Running Java program via Command Prompt with input and output files)[2023-07-07]
你似乎有两个问题。 1)当您手动运行程序时,您将包含-cp命令行选项,但在尝试从输入中读取时则不包括-cp命令行选项。 在这两种情况下你都需要它 - 这告诉java在哪里可以找到你的类文件。 2)处理输入的方式与您传入的输入不匹配。 您只在收到空行时调用calculate ( if(line.isEmpty()) ),但类似于 echo some inputs to the calculator | java -cp . package.sub.Calc 永远不会产生空白行。 你要么做: printf " ...你必须使用AJAX。 假设我们有一个表( 订单 ),我们有一个表( order_items )。 我们将添加一些带有一些好东西( 物品 )的行,它们的价格和数量。 假设用户已经打开了新订单并添加了新行。 在行中,我们将select与项目,跨度价格和文本字段数量放在一起。 在表格下我们有总数 用户选择项目。 当选择项目时,我们为此选择调用'on_change'javascript事件。 在该调用中,我们向项目控制器(方法'show')发送了AJAX请求,其中包含所选项目的ID。 在控制器#show中,我们找到 ...如何从java中的命令提示符提示“打开文件窗口”?(how to prompt “open file window” from command prompt in java? [duplicate])[2022-06-13]
您可以使用JFileChooser从对话框中选择文件。 假设您想在Java Swing应用程序之外启动它,您可以继续下一步: final JFileChooser fc = new JFileChooser(); // Open the dialog using null as parent component if you are outside a // Java Swing application otherwise provide the parent comment instead int ret ...你可以使用python输入文本并在命令提示符下按Enter键吗?(Can you use python to type text and press enter in command prompt?)[2022-01-26]
pycassa是一个带有完整API的Python模块。 您应该import模块并直接使用它,而不是尝试在Python内部操作它。 有关API的文档可在此处找到: http://pycassa.github.io/pycassa/api/index.html 相比之下, pycassaShell是pycassa周围的交互式shell包装器,用于手动探索(与程序执行相反)。 http://pycassa.github.io/pycassa/assorted/pycassa_shell.html 因此,我建议您调 ...由于对引导程序的模态调用是异步的,因此您需要对异步调用的流程进行一些控制。 这可以通过手动完成,但通常是一个巨大的麻烦(至少对我而言)。 那里有一些库(如q,异步等)。 但我建议https://github.com/caolan/async,因为它是更容易理解和开始使用的方法之一。 对于您的情况,您可能使用https://github.com/caolan/async#eachseriesarr-iterator-callback 而不是for循环,请使用以下代码片段: async.eachSeries(i ...相关文章
更多- Gradle构建Groovy项目
- Gradle构建多模块项目
- Gradle构建脚本流程
- Gradle 快速入门教程
- Gradle构建Java Web应用程序并在Tomcat上运行
- Gradle构建JAVA项目
- Groovy 环境配置
- Gradle构建命令详解
- Gradle插件详解
- Gradle单元测试
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。