ec4j / editorconfig-maven-plugin

A Maven plugin for checking whether project files comply with format rules defined in .editorconfig files and eventually also for fixing the violations
Apache License 2.0
54 stars 13 forks source link

DirectoryScanner missing on Maven 3.9.0 #70

Closed Tockra closed 1 year ago

Tockra commented 1 year ago

Hi,

after my maven upgrade some problems occured.

mvn --version

pache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /usr/local/Cellar/maven/3.9.0/libexec
Java version: 17.0.5, vendor: Amazon.com Inc., runtime: /Users/myuser/.sdkman/candidates/java/17.0.5-amzn
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "x86_64", family: "mac"
user@My-MBP demo % mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ demo ---
[INFO] Deleting /Users/user/Downloads/demo/target
[INFO]
[INFO] --- editorconfig:0.1.1:check (check) @ demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.608 s
[INFO] Finished at: 2023-02-23T17:14:07+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check (check) on project demo: Execution check of goal org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check failed: A required class was missing while executing org.ec4j.maven:editorconfig-maven-plugin:0.1.1:check: org/codehaus/plexus/util/DirectoryScanner
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.ec4j.maven:editorconfig-maven-plugin:0.1.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/user/.m2/repository/org/ec4j/maven/editorconfig-maven-plugin/0.1.1/editorconfig-maven-plugin-0.1.1.jar
[ERROR] urls[1] = file:/Users/user/.m2/repository/org/ec4j/linters/editorconfig-lint-api/0.2.1/editorconfig-lint-api-0.2.1.jar
[ERROR] urls[2] = file:/Users/user/.m2/repository/org/ec4j/core/ec4j-core/0.2.1/ec4j-core-0.2.1.jar
[ERROR] urls[3] = file:/Users/user/.m2/repository/org/ec4j/linters/editorconfig-linters/0.2.1/editorconfig-linters-0.2.1.jar
[ERROR] urls[4] = file:/Users/user/.m2/repository/org/antlr/antlr4-runtime/4.7/antlr4-runtime-4.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.codehaus.plexus.util.DirectoryScanner
[ERROR] -> [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/PluginContainerException

I created a new spring boot application on start.spring.io . Then I changed pom.xml to use the editorconfig-maven-plugin:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.3-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.ec4j.maven</groupId>
                <artifactId>editorconfig-maven-plugin</artifactId>
                <version>0.1.1</version>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <inherited>true</inherited>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

</project>

Using the "mvnw" (version 3.8.6) works fine. So it seems to be related with maven 3.9.0

Maybe somebody can help.

T

Tockra commented 1 year ago

Related to https://github.com/ec4j/editorconfig-maven-plugin/pull/68

vikhyatprabhu commented 1 year ago

Will a new version be released for this fix?

ppalaga commented 1 year ago

Yes, I hope to be able to do it within a week.