more detail on patch-module error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

more detail on patch-module error

mgainty
contents of build.xml
<target name="compile" description="compile the source">
    <!-- Compile the Java code from ${src} into ${build} -->
    <path id="lib.path.ref">
     <fileset dir="./target/classes"/>
     <fileset dir="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1\0.8\jar"/>
     <fileset dir="./target/classes"/>
    </path>
    <javac srcdir="${src}" destdir="${build}" classpath="./target/classes" source="1.9" target="1.9">
    <compilerarg value="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />
    <classpath>
    <pathelement location="$USER_HOME/.m2/REPOSI~1/org/slf4j/SLF4J-~1/1.7.9/slf4j-api-1.7.9.jar"/>
    <pathelement location="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1/0.8/sorcerer-javac-0.8.jar"/>
    <pathelement location="/Java/JDK18~1.0_1/jre/lib"/>
    <pathelement location="./target/classes"/>
    </classpath>
    </javac>

the good news is that <compilerarg> seems to be recognised by javac
the bad news is when running
>ant compile
build.xml:16: Error starting modern compiler

javac -version
9.04

ant -version
Apache Ant(TM) version 1.10.2 compiled on February 3 2018

/*the sad news is that patch-module seems to work in maven maven-compiler-plugin.here is pom.xml */
   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>3.8.0</version>
       <configuration>
        <source>1.9</source>
        <target>1.9</target>
        <compilerargs>
        <arg>--patch-module java.base=src/main/java</arg>
        <arg>-d build ./src/main/java/jdk/compiler/DocTree.java</arg>
        </compilerargs>
       </configuration>
      </plugin>
  </target>

advice on getting --patch-module to properly configure in <javac> will be appreciated!
-m
<https://github.com/javapathfinder/jpf-core/issues/27>
Reply | Threaded
Open this post in threaded view
|

Re: more detail on patch-module error

Stefan Bodewig
On 2020-04-08, Martin Gainty wrote:

> contents of build.xml
> <target name="compile" description="compile the source">
>     <!-- Compile the Java code from ${src} into ${build} -->
>     <path id="lib.path.ref">
>      <fileset dir="./target/classes"/>
>      <fileset dir="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1\0.8\jar"/>
>      <fileset dir="./target/classes"/>
>     </path>
>     <javac srcdir="${src}" destdir="${build}" classpath="./target/classes" source="1.9" target="1.9">
>     <compilerarg value="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />
>     <classpath>
>     <pathelement location="$USER_HOME/.m2/REPOSI~1/org/slf4j/SLF4J-~1/1.7.9/slf4j-api-1.7.9.jar"/>
>     <pathelement location="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1/0.8/sorcerer-javac-0.8.jar"/>
>     <pathelement location="/Java/JDK18~1.0_1/jre/lib"/>
>     <pathelement location="./target/classes"/>
>     </classpath>
>     </javac>

> the good news is that <compilerarg> seems to be recognised by javac
> the bad news is when running
>> ant compile
> build.xml:16: Error starting modern compiler

It sure says mor than just "error startign the modern compiler". What is
the actual error?

>     <compilerarg value="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />

The value attribute takes the string you provide and turns it into a
single command line argument. This is not what javac expects. Either use
separate <compilerarg> elements per argument or use the line attribute
as in

  <compilerarg line="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />

which splits the attribute's value into separate arguments on spaces.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: more detail on patch-module error

mgainty
when i tasked javac with compilerarg directory specification
-d ./src/main/java/jdk/compiler
the javac compiler found the source files and now i have correct compilation

Vielen Danke Stefan!
martin-

________________________________
From: Stefan Bodewig <[hidden email]>
Sent: Saturday, April 11, 2020 4:57 AM
To: [hidden email] <[hidden email]>
Subject: Re: more detail on patch-module error

On 2020-04-08, Martin Gainty wrote:

> contents of build.xml
> <target name="compile" description="compile the source">
>     <!-- Compile the Java code from ${src} into ${build} -->
>     <path id="lib.path.ref">
>      <fileset dir="./target/classes"/>
>      <fileset dir="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1\0.8\jar"/>
>      <fileset dir="./target/classes"/>
>     </path>
>     <javac srcdir="${src}" destdir="${build}" classpath="./target/classes" source="1.9" target="1.9">
>     <compilerarg value="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />
>     <classpath>
>     <pathelement location="$USER_HOME/.m2/REPOSI~1/org/slf4j/SLF4J-~1/1.7.9/slf4j-api-1.7.9.jar"/>
>     <pathelement location="$USER_HOME/.m2/REPOSI~1/org/jvnet/SORCER~1/0.8/sorcerer-javac-0.8.jar"/>
>     <pathelement location="/Java/JDK18~1.0_1/jre/lib"/>
>     <pathelement location="./target/classes"/>
>     </classpath>
>     </javac>

> the good news is that <compilerarg> seems to be recognised by javac
> the bad news is when running
>> ant compile
> build.xml:16: Error starting modern compiler

It sure says mor than just "error startign the modern compiler". What is
the actual error?

>     <compilerarg value="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />

The value attribute takes the string you provide and turns it into a
single command line argument. This is not what javac expects. Either use
separate <compilerarg> elements per argument or use the line attribute
as in

  <compilerarg line="--patch-module java.base=src -d ./src/main/java/jdk/compiler/DocTree.java" />

which splits the attribute's value into separate arguments on spaces.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]