简体   繁体   English

Jenkins-警告插件和IntelliJ IDEA解析器

[英]Jenkins - Warnings Plugin & IntelliJ IDEA Parser

I am having issues opening the files that contains IntelliJ IDEA Inspection warnings using Jenkins and Warnings Plugin . 我在使用JenkinsWarnings Plugin打开包含IntelliJ IDEA Inspection警告的文件时遇到问题。

The path to my files looks weird - file://$PROJECT_DIR$/app/src/main..../Foo.java in the .xml generated files by ./inspect.sh 我的文件路径看起来很奇怪file://$PROJECT_DIR$/app/src/main..../Foo.java生成的.xml文件中的file://$PROJECT_DIR$/app/src/main..../Foo.java ./inspect.sh

When I click on the file I get the following error: 当我单击文件时,出现以下错误:

`java.io.IOException: Failed to copy file:/$PROJECT_DIR$/app/src/main/java`/

These are some screenshots of my files: 这些是我文件的一些屏幕截图:

在此处输入图片说明在此处输入图片说明在此处输入图片说明

I am using the ./inspect.sh from Android Studio, not from actual IntelliJ. 我使用的是来自Android Studio的./inspect.sh,而不是实际的IntelliJ。 Could that be the problem? 这可能是问题吗?

Thanks in advance. 提前致谢。

In the end I have added an extra build step where I clean the .xml files that are output by ./inspect.sh. 最后,我添加了一个额外的构建步骤,其中我清理了./inspect.sh输出的.xml文件。 I have also added a line of code that removes all the inspects related to the build (generated) directory. 我还添加了一行代码,删除了与构建(生成)目录相关的所有检查。 Hope this helps anyone who was stuck with this issue. 希望这对遇到此问题的人有所帮助。

Below you have the tweaked inspect.sh file and the two separate build steps: 下面是经过调整的inspect.sh文件和两个单独的构建步骤:

inspect.sh 检查文件

#!/bin/sh
#
# ------------------------------------------------------
# Android Studio offline inspection script.
# ------------------------------------------------------
#

export DEFAULT_PROJECT_PATH="$(pwd)"

cd ..
exec "MacOS/studio" inspect "$@"

Build Step 1 构建步骤1

cd ${WORKSPACE}/inspectionsresults
rm *.xml
cd "${ANDROID_STUDIO_HOME_BIN}"
./inspect.sh ${WORKSPACE} ${WORKSPACE}/inspections_profile.xml ${WORKSPACE}/inspectionsresults -v2 -d ${WORKSPACE}/app

Build Step 2 建立步骤2

cd ${WORKSPACE}/inspectionsresults
sed -i .bak "s,file://\\\$PROJECT_DIR\\\$,${WORKSPACE},g" *.xml
sed -i .bak "s,file:///,,g" *.xml
/usr/local/bin/xml ed -L  -d "/problems/problem[contains(file,'generated')]"  *.xml
rm *.bak

I have used xmlstarlet to remove the "generated" problems. 我已经使用xmlstarlet来消除“生成的”问题。

brew install xmlstarlet

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

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