java.net.MalformedURLException:无协议:XXX.xml

java.net.MalformedURLException:无协议:XXX.xml,java,xml,maven,coding-style,Java,Xml,Maven,Coding Style,我想做的是: 在我的Java maven项目的构建中强制进行样式检查 我在pom.xml中添加了此块: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plug

我想做的是:

在我的Java maven项目的构建中强制进行样式检查

我在pom.xml中添加了此块:

     <build>
        <plugins>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <failOnViolation>true</failOnViolation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <configLocation>${project.basedir}/fishercoder_codestyle.xml</configLocation>
                </configuration>
            </plugin>
        </plugins>
    </build>
  • 我已授予此.xml文件的完全权限
  • 有人帮忙吗

    编辑: 这是我的pom.xml文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.fishercoder</groupId>
        <artifactId>XXX-algorithms</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <build>
            <plugins>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.9.1</version>
                    <configuration>
                        <failOnViolation>true</failOnViolation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <configLocation>${project.basedir}/fishercoder_codestyle.xml</configLocation>
                    </configuration>
                </plugin>
    
            </plugins>
        </build>
    
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
    </project>
    
    
    4.0.0
    com.fishercoder
    XXX算法
    1.0-快照
    org.apache.maven.plugins
    maven编译器插件
    1.8
    1.8
    org.apache.maven.plugins
    maven checkstyle插件
    2.9.1
    真的
    真的
    ${project.basedir}/fishercoder_codestyle.xml
    朱尼特
    朱尼特
    4.12
    测试
    

    我的目录中实际上没有settings.xml文件。

    UPDATE:With@ortomala lokni help,我将stylecheck块放入
    reporting
    部分,现在错误消失了。然而,我认为这个样式检查并没有真正发挥作用:我在下面有一个块:我故意放了多行长度超过100的行,但是样式检查仍然成功。有什么帮助吗?更新:有了@ortomala lokni帮助,我将样式检查块放入了
    报告部分,现在错误消失了。然而,我认为这个样式检查并没有真正发挥作用:我在下面有一个块:我故意放了多行长度超过100的行,但是样式检查仍然成功。需要帮忙吗?
    
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.fishercoder</groupId>
        <artifactId>XXX-algorithms</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <build>
            <plugins>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.9.1</version>
                    <configuration>
                        <failOnViolation>true</failOnViolation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <configLocation>${project.basedir}/fishercoder_codestyle.xml</configLocation>
                    </configuration>
                </plugin>
    
            </plugins>
        </build>
    
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
    </project>