Skip to content

Commit 573f030

Browse files
authored
Merge pull request #1073 from WebFuzzing/jdk-add-opens-for-jar
trying add-opens in jar
2 parents 61fe88b + 33ea242 commit 573f030

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@
328328
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
329329
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
330330
</manifest>
331+
<manifestEntries>
332+
<!-- needs to be kept in sync with JdkIssue -->
333+
<Add-Opens>java.base/java.net java.base/java.util</Add-Opens>
334+
</manifestEntries>
331335
</archive>
332336
<finalName>evomaster</finalName>
333337
<appendAssemblyId>false</appendAssemblyId>

core/src/main/kotlin/org/evomaster/core/JdkIssue.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ object JdkIssue {
2222
return true
2323
}catch (e: Exception){
2424

25-
//This needs to be kept in sync with makeExecutable.sh
25+
//This needs to be kept in sync with core/pom.xml -> maven-assembly-plugin
2626
val command = "--add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED"
2727

2828
LoggingUtil.getInfoLogger().error(inRed("It looks like you are running EvoMaster with JDK 17+," +
2929
" but did not setup '--add-opens'." +
3030
" Unfortunately, Java has broken a lot of backward compatibility in its recent versions." +
3131
" You should use the EvoMaster OS installers (e.g., .msi and .dmg files)." +
32-
" If you want to use the JAR file directly, you need to either upgrade to JDK 8 or 11, or" +
33-
" setup --add-opens JVM option manually on the command-line" +
32+
" If you use the JAR file directly," +
33+
" --add-opens are now set directly in the manifest file." +
34+
" But this is not the case if you run EvoMaster directly from inside an IDE." +
35+
" You would need to set JVM options manually in the IDE" +
3436
" (or in the JDK_JAVA_OPTIONS environment variable):\n") +
3537
inBlue("$command"))
3638

makeExecutable.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ COPYRIGHT="Copyright 2016-$YEAR EvoMaster Team"
3838
VENDOR="EvoMaster Team"
3939

4040
$JPACKAGE --main-jar $JAR --input $BUILD --dest $RELEASE --name evomaster \
41-
--copyright "$COPYRIGHT" --license-file ./LICENSE --vendor "$VENDOR" --app-version $VERSION $OS \
42-
--java-options "--add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED"
43-
# needs to be kept in sync with JdkIssue
41+
--copyright "$COPYRIGHT" --license-file ./LICENSE --vendor "$VENDOR" --app-version $VERSION $OS
42+

release_notes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Under development in `master` branch.
44

55
### New Features
6+
- when running JAR file with JDK 17+, no longer need to manually specify --add-opens commands
67
- schema validation for OpenAPI schemas, with summary of issues printed in the console logs
7-
- Generated tests that detect faults have now comments highlighting those faults.
8+
- generated tests that detect faults have now comments highlighting those faults.
89

910
### Bug Fixes
1011
- fixed release of JAR requiring JDK 21 by mistake

0 commit comments

Comments
 (0)