简体   繁体   中英

Jenkins - Warnings Plugin & IntelliJ IDEA Parser

I am having issues opening the files that contains IntelliJ IDEA Inspection warnings using Jenkins and Warnings Plugin .

The path to my files looks weird - file://$PROJECT_DIR$/app/src/main..../Foo.java in the .xml generated files by ./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. 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. 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

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

export DEFAULT_PROJECT_PATH="$(pwd)"

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

Build Step 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

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.

brew install xmlstarlet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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