Skip to content

Commit

Permalink
Merge pull request #867 from hazendaz/site
Browse files Browse the repository at this point in the history
Small cleanups and use 'log' via trait instead of calling getLog
  • Loading branch information
hazendaz committed Aug 27, 2024
2 parents fb8d795 + 6ca9f58 commit fb600c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,17 @@ import org.apache.maven.artifact.repository.ArtifactRepository

import org.apache.maven.doxia.siterenderer.Renderer
import org.apache.maven.doxia.tools.SiteTool

import org.apache.maven.execution.MavenSession

import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugin.MojoExecutionException

import org.apache.maven.plugins.annotations.Component
import org.apache.maven.plugins.annotations.Execute
import org.apache.maven.plugins.annotations.LifecyclePhase
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope

import org.apache.maven.project.MavenProject

import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver

import org.codehaus.plexus.resource.ResourceManager

abstract class BaseViolationCheckMojo extends AbstractMojo {
Expand Down Expand Up @@ -77,7 +71,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
*
* @since 3.1.12.2
*/
@Parameter(property = "spotbugs.outputXmlFilename", defaultValue = "spotbugsXml.xml")
@Parameter(defaultValue = "spotbugsXml.xml", property = "spotbugs.outputXmlFilename")
String spotbugsXmlOutputFilename

/** Doxia Site Renderer. */
Expand Down
15 changes: 4 additions & 11 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsGui.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2005-2023 the original author or authors.
* Copyright 2005-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,22 +18,15 @@ package org.codehaus.mojo.spotbugs
import groovy.ant.AntBuilder

import org.apache.maven.artifact.repository.ArtifactRepository

import org.apache.maven.execution.MavenSession

import org.apache.maven.plugin.AbstractMojo

import org.apache.maven.plugins.annotations.Component
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import org.apache.maven.plugins.annotations.ResolutionScope

import org.apache.maven.project.MavenProject

import org.apache.maven.repository.RepositorySystem

import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver

import org.codehaus.plexus.resource.ResourceManager

/**
Expand Down Expand Up @@ -120,7 +113,7 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
*
* @since 3.1.12.2
*/
@Parameter(property = "spotbugs.outputXmlFilename", defaultValue = "spotbugsXml.xml")
@Parameter(defaultValue = "spotbugsXml.xml", property = "spotbugs.outputXmlFilename")
String spotbugsXmlOutputFilename

/**
Expand All @@ -130,15 +123,15 @@ class SpotBugsGui extends AbstractMojo implements SpotBugsPluginsTrait {
*
* @since 2.2
*/
@Parameter(property="encoding", defaultValue = '${project.build.sourceEncoding}')
@Parameter(defaultValue = '${project.build.sourceEncoding}', property="encoding")
String encoding

/**
* Maximum Java heap size in megabytes (default=512).
*
* @since 2.2
*/
@Parameter(property="spotbugs.maxHeap", defaultValue = "512")
@Parameter(defaultValue = "512", property="spotbugs.maxHeap")
int maxHeap

/**
Expand Down
11 changes: 5 additions & 6 deletions src/main/groovy/org/codehaus/mojo/spotbugs/SpotBugsMojo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import org.apache.maven.reporting.AbstractMavenReport
import org.apache.maven.reporting.MavenReport
import org.apache.maven.repository.RepositorySystem
import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver

import org.codehaus.plexus.resource.ResourceManager
import org.codehaus.plexus.resource.loader.FileResourceLoader

Expand Down Expand Up @@ -112,7 +111,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
*
* @since 4.7.2.2
*/
@Parameter(property = "spotbugs.sarifOutputFilename", defaultValue = "spotbugsSarif.json", required = true)
@Parameter(defaultValue = "spotbugsSarif.json", property = "spotbugs.sarifOutputFilename", required = true)
String sarifOutputFilename

/**
Expand All @@ -136,7 +135,7 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
*
* @since 3.1.12.2
*/
@Parameter(property = "spotbugs.outputXmlFilename", defaultValue = "spotbugsXml.xml")
@Parameter(defaultValue = "spotbugsXml.xml", property = "spotbugs.outputXmlFilename")
String spotbugsXmlOutputFilename

/** Doxia Site Renderer. */
Expand Down Expand Up @@ -1255,12 +1254,12 @@ class SpotBugsMojo extends AbstractMavenReport implements SpotBugsPluginsTrait {
String newFileName = indexer.searchActualFilesLocation(originalFullPath)

if (newFileName != null) {
if (getLog().isDebugEnabled()) {
getLog().info("$originalFullPath modified to $newFileName")
if (log.isDebugEnabled()) {
log.info("$originalFullPath modified to $newFileName")
}
loc.physicalLocation.artifactLocation.uri = newFileName
} else {
getLog().warn("No source file found for $originalFullPath. " +
log.warn("No source file found for $originalFullPath. " +
"The path include in the SARIF report could be incomplete.")
}
}
Expand Down

0 comments on commit fb600c4

Please sign in to comment.