oVirt / ovirt-engine

The oVirt Engine virtualization manager
Other
507 stars 262 forks source link

SKIP_CHECKS=1 doesn't skip checkstyle #105

Open sandrobonazzola opened 2 years ago

sandrobonazzola commented 2 years ago

I changed the Makefile:

-SKIP_CHECKS=0
+SKIP_CHECKS=1

but using xmvn --local instead of mvn still lead to:

[ERROR] Failed to execute goal on project ovirt-checkstyle-extension:
Could not resolve dependencies for project org.ovirt.engine:ovirt-checkstyle-extension:jar:4.5.0-SNAPSHOT:
Cannot access central (https://repo1.maven.org/maven2) in offline mode and the artifact 
com.puppycrawl.tools:checkstyle:jar:9.3 has not been downloaded from it before. -> [Help 1]

As com.puppycrawl.tools:checkstyle is not available in CentOS Stream and as it's used only during development we should be able to skip it during RPM build.

sandrobonazzola commented 2 years ago

even changing:

 maven:
        MAVEN_OPTS="${MAVEN_OPTS} "'$(BUILD_JAVA_OPTS_MAVEN)' \
              xmvn --offline \
-                       $(BUILD_FLAGS) \
+                       $(DEV_BUILD_FLAGS) \

the rendered command becomes:

    xmvn --offline \
        -P brand-source-maps   -Danimal.sniffer.skip -Dcheckstyle.skip \
        install

but checkstyle is not skipped.

sandrobonazzola commented 2 years ago

SKIP_CHECKS was introduced by @gregsheremeta perhaps he can spend some time helping on this :-)

gregsheremeta commented 2 years ago

Oh my ... I flushed this cache page from my brain so long ago :)

Is the goal to always skip checks because they'll never work in CentOS stream? If so, perhaps perma-disabling it in the pom would work per https://stackoverflow.com/a/54533408/994243

If not, I think we'd have to figure out why the variable is being ignored.

sandrobonazzola commented 2 years ago

The goal is to be able to run the checks as developer but skip them at RPM build time

kmahapatra530 commented 1 year ago

Hi, my name is Koshik and I am a student at UT Austin. I'd like to work on this issue as part of my virtualization class assignment.

sandrobonazzola commented 1 year ago

Welcome aboard @kmahapatra530 ! assigned this issue to you.

kmahapatra530 commented 1 year ago

I tried a few things on my redhat machine:

Changed SKIP_CHECKS=1 temporarily in the Makefile even if I could change from command line.

Made the following changes to Makefile to test the answer quoted from stackoverflow above:

-DEV_EXTRA_BUILD_FLAGS:=$(DEV_EXTRA_BUILD_FLAGS) -Danimal.sniffer.skip -Dcheckstyle.skip +DEV_EXTRA_BUILD_FLAGS:=$(DEV_EXTRA_BUILD_FLAGS) -Danimal.sniffer.skip -Dcheckstyle.skip -Dskip.checkstyle -Dovirt-checkstyle-extension.skip -Dskip.ovirt-checkstyle-extension

The reason for trying both checkstyle.skip and skip.checkstyle is that people have reported different working combinations in stack overflow. I tried the same for ovirt-checkstyle-extension as well.

I keep getting the following error:

[INFO] oVirt Checkstyle Checks ............................ FAILURE [ 0.080 s]

Only warning I see here is:

[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ checkstyles --- [INFO] Building jar: ..../ovirt-engine/build-tools-root/checkstyles/target/checkstyles- 4.5.5-SNAPSHOT.jar [INFO] [INFO] --- ovirt-jboss-modules-maven-plugin:2.0.1:attach-modules (default) @ checkstyles --- [INFO] The modules source directory ".../ovirt-engine/build-tools-root/checkstyles/src /main/modules" doesn't exist, no modules artifacts will be attached. [INFO] [INFO] --- maven-jar-plugin:3.2.2:test-jar (test-jar) @ checkstyles --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar:.../ovirt-engine/build-tools-root/checkstyles/target/checkstyles- 4.5.5-SNAPSHOT-tests.jar

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on p roject ovirt-checkstyle-extension: Fatal error compiling: invalid flag: --release -> [Help 1]

I also tried modifying pom.xml directly to test if the skip configuration works:

org.apache.maven.plugins maven-checkstyle-plugin ${maven-checkstyle-plugin.version} com.puppycrawl.tools checkstyle ${checkstyle.version} org.ovirt.engine checkstyles ${engine.version} org.ovirt.engine ovirt-checkstyle-extension ${engine.version} true true checkstyle.xml checkstyle-suppressions.xml runNlsCheck=false **true true** ....
gregsheremeta commented 1 year ago

Those errors are so hard to read :) The only one that matters is this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project ovirt-checkstyle-extension: Fatal error compiling: invalid flag: --release

In other words, sending the release parameter to maven-compiler-plugin is invalid.

Try removing this line: https://github.com/oVirt/ovirt-engine/blob/master/pom.xml#L846

kmahapatra530 commented 1 year ago

Removing the release flag gives a complaint about other flags (target and source). If I remove them all, then it doesn’t build. I suspect no files are associated with the compilation and hence the problem.