Hi again,
actually I managed to exclude the project by using the FQN (I was missing
the "upgrade-acid/" part):

mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar \
 -DskipTests -Dit.skipTests -Dmaven.javadoc.skip -pl
'!upgrade-acid,!upgrade-acid/pre-upgrade'

I would still like to hear your opinion about the exclusion, since it will
be a problem when moving to JDK11 anyway, which I have seen it's a blocker
for 4.0.0 release.

Best regards,
Alessandro

On Thu, 5 May 2022 at 16:38, Alessandro Solimando <
alessandro.solima...@gmail.com> wrote:

> Hi everyone,
> I am working on https://issues.apache.org/jira/browse/HIVE-26196.
>
> As you might know, Sonar analysis must now run with at least JDK 11, and
> when I tried it failed as follows:
>
> [ERROR] Failed to execute goal on project hive-pre-upgrade: Could not
> resolve dependencies for project
> org.apache.hive:hive-pre-upgrade:jar:4.0.0-alpha-2-SNAPSHOT: Could not find
> artifact jdk.tools:jdk.tools:jar:1.7 at specified path
> /Users/asolimando/.sdkman/candidates/java/11.0.11.hs-adpt/../lib/tools.jar
> -> [Help 1]
>
> The issue is located here:
>
> https://github.com/apache/hive/blob/master/upgrade-acid/pre-upgrade/pom.xml#L52-L75
>
> Adding an exclusion on jdk.tools as follows fixes the problem:
> <exclusion>
>   <groupId>jdk.tools</groupId>
>   <artifactId>jdk.tools</artifactId>
> </exclusion>
>
> I guess it's safe to add this exclusion, since the of the dependency scope
> is "provided" (meaning that the dependency is expected to be in the
> classpath already at runtime, so the exclusion won't interfere with that,
> nothing is packaged differently from Hive due to the exclusion), and both
> compilation under JDK8 and the run of the full test suite in CI were OK.
>
> Do you guys see any problem with this approach?
>
> Before this solution, I have tried to add the "skip.sonar" maven property
> (as per
> https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/)
> but it is ignored.
>
> Another approach would have been to exclude the submodule from sonar
> analysis using maven reactor, but I can't seem to find a name of the
> module, "upgrade-acid" is excluded (but the submodule mentioned here still
> gets processed and fails), but "pre-upgrade" does not and fails as follows:
>
> $ mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar \
>  -DskipTests -Dit.skipTests -Dmaven.javadoc.skip -pl '!pre-upgrade'
> [INFO] Scanning for projects...
> [ERROR] [ERROR] Could not find the selected project in the reactor:
> pre-upgrade @
> [ERROR] Could not find the selected project in the reactor: pre-upgrade ->
> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the
> -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException
>
> Best regards,
> Alessandro
>

Reply via email to