spotbugs / discuss

SpotBugs mailing list
6 stars 1 forks source link

spotbugs maven plugin gives error: No plugin found for prefix 'spotbugs' #52

Closed kc7bfi closed 5 years ago

kc7bfi commented 6 years ago

I have configured the spotbugs-maven-plugin in my parent project. When I execute

mvn spotbugs:spotbugs

I get the error:

No plugin found for prefix 'spotbugs' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\m2), central (https://repo.maven.apache.org/maven2)]

However, if I run it against a specific project with

mvn spotbugs:spotbugs -pl :subproj-one

It works. Any idea what I may be doing wrong? I have other plugins, like pmd, and I can run them from the parent project as "mvn pmd:pmd".

David

ghost commented 5 years ago

@kc7bfi any update on this? I'm encountering this as well.

$ mvn -version
?[1mApache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)?[m
Maven home: C:\ProgramData\chocolatey\lib\maven\apache-maven-3.5.2\bin\..
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_162\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
 <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <warName>shopritemobileapplication</warName>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>3.1.8-SNAPSHOT</version>
                    <dependencies>
                        <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
                        <dependency>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>3.1.8</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>3.1.8-SNAPSHOT</version>
            </plugin>
        </plugins>
    </build>

Interestingly, when using with reporting(mvn site) it generates the report fine.

KengoTODA commented 5 years ago

This is not about SpotBugs but Maven's mechanism. Then I recommend you to check document in maven site.

My recommendation is not using spotbugs:spotbugs but using fullname like com.github.spotbugs:spotbugs-maven-plugin:3.1.7:spotbugs instead.

Fullname is described in Maven help site: https://spotbugs.github.io/spotbugs-maven-plugin/spotbugs-mojo.html