Skip to content

Commit e4da990

Browse files
author
Nicolai Parlog
committed
Create module declaration and fix modular build
1 parent e707c46 commit e4da990

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

pom.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@
4646
<artifactId>maven-compiler-plugin</artifactId>
4747
<version>3.9.0</version>
4848
<configuration>
49-
<!-- The flag "add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED"
50-
is needed to get access to `@ReservedStackAccess` in `ReservedStackAccess` -->
5149
<!-- The flag "enable-preview" is needed for preview language features
5250
like switch expressions in Java 12-->
5351
<compilerArgs>
54-
<arg>--add-exports=java.base/jdk.internal.vm.annotation=ALL-UNNAMED</arg>
52+
<!-- get access to `@ReservedStackAccess` in `ReservedStackAccess` -->
53+
<arg>--add-exports=java.base/jdk.internal.vm.annotation=org.codefx.demo.java_x</arg>
5554
<arg>--enable-preview</arg>
5655
</compilerArgs>
5756
</configuration>
@@ -84,6 +83,8 @@
8483
<!-- execute files ending in `Demo` as tests -->
8584
<include>**/*Demo.java</include>
8685
</includes>
86+
<!-- make demos accessible for testing framework -->
87+
<argLine>--add-opens=org.codefx.demo.java_x/org.codefx.demo.java18.jvm.javadoc=ALL-UNNAMED</argLine>
8788
</configuration>
8889
</plugin>
8990
<plugin>
@@ -102,6 +103,7 @@
102103
<artifactId>maven-javadoc-plugin</artifactId>
103104
<version>3.3.1</version>
104105
<configuration>
106+
<sourcepath>src/main/java</sourcepath>
105107
<subpackages>org.codefx.demo.java18.jvm.javadoc</subpackages>
106108
</configuration>
107109
<executions>

src/main/java/module-info.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Project demonstrating various Java features introduced since Java 9.
3+
*/
4+
module org.codefx.demo.java_x {
5+
exports org.codefx.demo.java18.jvm.javadoc;
6+
7+
requires java.desktop;
8+
requires java.net.http;
9+
}

src/main/java/org/codefx/demo/java11/jvm/script/HelloJavaScripts.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// package only needed to make this entire project compile on the module path;
2+
// your scripts absolutely don't have to belong to a package, so you can elide this line
3+
package org.codefx.demo.java11.jvm.script;
4+
15
public class HelloJavaScripts {
26

37
public static void main(String[] args) {

0 commit comments

Comments
 (0)