Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
xmvn-connector.28016
0001-Mimic-maven-javadoc-plugin-for-source-and-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Mimic-maven-javadoc-plugin-for-source-and-release.patch of Package xmvn-connector.28016
From c2f74691a71509c3671d3bc612be285a511c53f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch> Date: Wed, 4 May 2022 13:26:00 +0200 Subject: [PATCH 1/2] Mimic maven-javadoc-plugin for -source and --release Consider the maven.compiler.source and maven.compiler.release properties. Skip module-info.java if source level is specified and it is < 9 or if non-modular Java is used --- .../fedoraproject/xmvn/mojo/JavadocMojo.java | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java index b2cd41fd..68d097f5 100644 --- a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java +++ b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/JavadocMojo.java @@ -84,9 +84,12 @@ public class JavadocMojo @Parameter( defaultValue = "${project.build.directory}", required = true ) private File buildDirectory; - @Parameter( property = "source" ) + @Parameter( property = "source", defaultValue = "${maven.compiler.source}" ) private String source; + @Parameter( defaultValue = "${maven.compiler.release}" ) + private String release; + private static String quoted( Object obj ) { String arg = obj.toString(); @@ -222,8 +225,9 @@ public class JavadocMojo List<Path> reactorClassPath = new ArrayList<>(); List<Path> fullClassPath = new ArrayList<>(); populateClasspath( reactorClassPath, fullClassPath ); + boolean isModular = !findFiles( reactorClassPath, "module-info\\.class" ).isEmpty(); - if ( findFiles( reactorClassPath, "module-info\\.class" ).isEmpty() ) + if ( !isModular ) { opts.add( "-classpath" ); } @@ -244,15 +248,41 @@ public class JavadocMojo opts.add( quoted( docencoding ) ); opts.add( "-doctitle" ); opts.add( quoted( "Javadoc for package XXX" ) ); - if ( source != null ) + + String sourceLevel = null; + if ( release != null && isModular ) + { + opts.add( "--release" ); + opts.add( quoted( release ) ); + sourceLevel = release; + + } + else if ( source != null ) { opts.add( "-source" ); opts.add( quoted( source ) ); + sourceLevel = source; + } + + boolean skipModuleInfo = !isModular; + if ( sourceLevel != null && !skipModuleInfo ) + { + try + { + float f = Float.parseFloat( sourceLevel ); + if ( f < 9 ) + skipModuleInfo = true; + } + catch ( Exception e ) + { + // pass, we assume that we use modular Java + } } for ( Path file : sourceFiles ) { - opts.add( quoted( file ) ); + if ( !skipModuleInfo || !file.endsWith( "module-info.java" ) ) + opts.add( quoted( file ) ); } Files.write( outputDir.resolve( "args" ), opts, StandardOpenOption.CREATE ); -- 2.36.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor