#1786 breaks compilation with Eclipse compiler

Open
#2,000 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
build-system

Research direction

Start by reviewing pull request #1786 and the dependency declarations that added javax.xml.stream:stax-api:1.0-2. Reproduce the failure with the dev.aspectj:aspectj-maven-plugin test-compile goal and compare it with the standard Maven compiler. Done means projects using the Eclipse compiler compile without the duplicate java.xml module error.

Written by the indexing model from the issue text.

Description

https://github.com/microsoft/kiota-java/pull/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>
Dominant language
Java
Stars
38
Forks
34
Avg merge
14h 29m
Merged PRs (30d)
22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/kiota-java

All issues in microsoft/kiota-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.