首页 \ 问答 \ 由Ctrl + C终止时要运行的命令(Command to be run when it is terminated by Ctrl+C)

由Ctrl + C终止时要运行的命令(Command to be run when it is terminated by Ctrl+C)

是否有一个保留的命令名称将在用户使用Control + c终止整个脚本时运行? 例如,如果我想做puts "Script terminated by user." 当脚本终止时,我该怎么办?


Is there a reserved command name that will be run when the entire script is terminated by the user with Control+c? For example, if I wanted to do puts "Script terminated by user." when the script is terminated, how can I do it?


原文:https://stackoverflow.com/questions/8321588
更新时间:2023-11-16 11:11

最满意答案

当您运行目标archetype:create-from-project ,Maven会生成一个POM文件,用于在target/generated-sources/archetype/pom.xml构建原型,然后在此POM上运行package目标(默认情况下)。

生成的POM文件没有project.build.sourceEncoding或定义编码的任何其他属性,这就是为什么您收到警告。

POM从这个原型通过org.apache.maven.archetype.creator.FilesetArchetypeCreator#createArchetypeProjectPom ,并且从该代码org.apache.maven.archetype.creator.FilesetArchetypeCreator#createArchetypeProjectPom ,似乎没有一种方法来向生成的POM文件添加属性。


When you run the goal archetype:create-from-project, Maven generates a POM file for building the archetype at target/generated-sources/archetype/pom.xml and then runs the package goal (by default) on this POM.

The generated POM file doesn't have project.build.sourceEncoding or any other property defining encoding, and that's why you get the warning.

The POM is generated from this prototype by org.apache.maven.archetype.creator.FilesetArchetypeCreator#createArchetypeProjectPom, and from that code there doesn't seem to be a way to add properties to the resulting POM file.

相关问答

更多
  • 当您运行目标archetype:create-from-project ,Maven会生成一个POM文件,用于在target/generated-sources/archetype/pom.xml构建原型,然后在此POM上运行package目标(默认情况下)。 生成的POM文件没有project.build.sourceEncoding或定义编码的任何其他属性,这就是为什么您收到警告。 POM从这个原型通过org.apache.maven.archetype.creator.FilesetArchetype ...
  • 好的,我发现问题。 我使用一些报告插件。 在我的文档中,我发现, 配置 - 当然,默认使用${project.reporting.outputEncoding} 。 所以我把属性添加为project元素的子元素,一切都很好: UTF-8 UTF-8
  • 我强烈反对修改mvn.cmd 。 即使你弄清楚如何在命令行和InteliJ中做到这一点,那么考虑转移到某种持续集成框架,例如Jenkins,它将使用默认的mvn.cmd ? 如果没有可能用现有的Maven工具实现你想要的东西,我建议编写自己的Maven插件,(参见本教程 ),并在那里放置所需的功能。 它将保证这一特定代码段将在所有环境中执行,这是确保每次都启动命令的方法。 I would strongly discourage modification of mvn.cmd. Even if you fig ...
  • 配置中存在拼写错误(可能是settings.xml或POM文件): http://:/artifactory/不是有效的URL,请尝试使用http://artifactory/ 。 编辑如果URL在浏览器中有效,则Maven无权访问。 错误消息说明:Maven尝试下载文件,服务器响应HTTP状态403(禁止) 。 由于它适用于Web浏览器,因此这绝对是Artifactory服务器上的settings.xml和权限的问题。 我曾经遇到过与Nexus类似的问题; 它被配置为拒绝访问某些包。 检查存储库服务器的日 ...
  • 您需要更新Webpack ,您拥有的版本已过时,当前版本为4.5.0 ,安装的版本为1.12.2 , Webpack CLI至少需要版本4.0.0 试试npm update -g webpack 如果这不起作用 试试npm install --save-dev webpack 或用纱线 试试yarn add webpack --dev You need to update Webpack, the version you have is outdated, the current version is 4. ...
  • 您可以通过在运行代码生成器时传递-Dfile.encoding=... JVM参数来覆盖JVM编码。 jOOQ本身支持从jOOQ 3.8开始指定生成文件的编码( 问题#4517 ): ... ... ... ISO-8859-1 ...
  • 我发现这个问题:在我的OpenCSV CSVReader类中,我有这样一行代码: CSVReader reader = new CSVReader(new FileReader(file), delimiter); 但由于我的输入文件是用UTF-8编码而没有BOM ,所以CSVReader没有实现UTF-8的编码。 所以我需要像这样告诉他: CSVReader reader = new CSVReader(new InputStreamReader(new FileInputStream(file), e ...
  • 你可以验证目标/目录中的依赖项是否可用并打包到jar或war中? 另外:你如何以及在哪里加载 对不起,但我不能评论我的低声誉。 Can you verify that the dependencies are available in your target/ directory and packaged into your jar or war? Also: how and where do you load the Sorry, but i can't comment with my low reput ...
  • 当然,Apache Maven Enforcer插件是你的朋友,特别是RequireProperty规则 Of course, the Apache Maven Enforcer Plugin is your friend, especially the RequireProperty Rule
  • 您错误显示“Unknown host smslib.org”。 您还将您的存储库定义为 smslib http://smslib.org/maven2/v3 请检查您是否可以访问smslib.org。 You error shows "Unknown host smslib.org". And you also defined your repository as

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。