Skip to content

#1786 breaks compilation with Eclipse compiler #2000

@kelunik

Description

@kelunik

#1786 causes compilation of projects with Eclipse compiler to fail:

[ERROR] Failed to execute goal dev.aspectj:aspectj-maven-plugin:1.14:test-compile (default) on project kiota-xml: AJC compiler errors:
[ERROR] error at
[ERROR] import javax.xml.stream.XMLInputFactory;
[ERROR]        ^^^^^^^^^^^^^^^^
[ERROR] /kiota-xml/src/test/java/com/example/kiota/xml/Foobar.java:3:0::0 The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml
[ERROR] error at
[ERROR] System.out.println(XMLInputFactory.newInstance().getClass().getName());
[ERROR]                    ^^^^^^^^^^^^^^^
[ERROR] /kiota-xml/src/test/java/com/example/kiota/xml/Foobar.java:9:0::0 XMLInputFactory cannot be resolved

It compiles fine with the standard Maven compiler plugin. The error is caused by the addition of api 'javax.xml.stream:stax-api:1.0-2'. An exclusion can be used as a workaround.

package com.example.kiota.xml;

import javax.xml.stream.XMLInputFactory;


public class Foobar {

   public static void main( String[] args ) {
      System.out.println(XMLInputFactory.newInstance().getClass().getName());
   }
}
<?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.example</groupId>
   <artifactId>kiota-xml</artifactId>
   <version>1.0-SNAPSHOT</version>

   <properties>
      <aspectj.version>1.9.22.1</aspectj.version>
      <maven.compiler.source>21</maven.compiler.source>
      <maven.compiler.target>21</maven.compiler.target>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>

   <dependencies>
      <dependency>
         <groupId>com.microsoft.kiota</groupId>
         <artifactId>microsoft-kiota-authentication-azure</artifactId>
         <version>1.8.8</version>
      </dependency>

      <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjrt</artifactId>
         <version>${aspectj.version}</version>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>dev.aspectj</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.14</version>
            <configuration>
               <release>21</release>
            </configuration>
            <executions>
               <execution>
                  <goals>
                     <goal>compile</goal>
                     <goal>test-compile</goal>
                  </goals>
               </execution>
            </executions>
            <dependencies>
               <dependency>
                  <groupId>org.aspectj</groupId>
                  <artifactId>aspectjrt</artifactId>
                  <version>${aspectj.version}</version>
               </dependency>
               <dependency>
                  <groupId>org.aspectj</groupId>
                  <artifactId>aspectjtools</artifactId>
                  <version>${aspectj.version}</version>
               </dependency>
            </dependencies>
         </plugin>
      </plugins>
   </build>
</project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions