-
Notifications
You must be signed in to change notification settings - Fork 4
405 enhancement fj doc lib direct add support to maven goal init and add #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fugerit79
merged 9 commits into
main
from
405-enhancement-fj-doc-lib-direct-add-support-to-maven-goal-init-and-add
Apr 25, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
49afb83
[fj-doc-maven-plugin] support add 'direct' goal to maven goal 'init' …
fugerit79 dbb31de
[fj-doc-maven-plugin] flavour 'direct' #405
fugerit79 fa80be2
[fj-doc-maven-plugin] remove sonar issues #405
fugerit79 ef53544
[fj-doc-playground-quarkus] project init - add verify and direct plug…
fugerit79 2e25838
fix maven project init #405
fugerit79 d16e61c
sonar issues #405
fugerit79 0374678
fix 'add' goal for direct plugin #405
fugerit79 4ca7bd8
code coverage #405
fugerit79 4d385a1
chore: skip CI native modules build and test on PR, execute on release
fugerit79 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/FeatureFacade.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.fugerit.java.doc.project.facade; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.fugerit.java.core.function.SafeFunction; | ||
import org.fugerit.java.core.io.StreamIO; | ||
import org.fugerit.java.core.lang.helpers.ClassHelper; | ||
|
||
import java.io.*; | ||
|
||
@Slf4j | ||
public class FeatureFacade { | ||
|
||
private FeatureFacade() {} | ||
|
||
public static void copyFlavourList( File baseFolder, String actualFlavour ) throws IOException { | ||
copyResourcesList( baseFolder, "flavour", actualFlavour ); | ||
} | ||
|
||
public static void copyFeatureList( File baseFolder, String featureId ) throws IOException { | ||
copyResourcesList( baseFolder, "feature", featureId ); | ||
} | ||
|
||
private static void copyResourcesList( File baseFolder, String mode, String id ) throws IOException { | ||
// copy all resources | ||
String listFilePath = String.format( "config/%s/%s-copy.txt", mode, id ); | ||
String baseFlavourPath = String.format( "config/%s/%s/", mode, id ); | ||
log.info( "loading list file {}, base flavour path {}", listFilePath, baseFlavourPath ); | ||
try (BufferedReader reader = new BufferedReader( new InputStreamReader(ClassHelper.loadFromDefaultClassLoader( listFilePath ) ) ) ) { | ||
reader.lines().forEach( s -> copyFile( s, baseFolder, baseFlavourPath ) ); | ||
} | ||
} | ||
|
||
protected static void insureParent( File file ) throws IOException { | ||
File parentFile = file.getParentFile(); | ||
if ( !parentFile.exists() ) { | ||
log.info( "creates parent directory {}, mkdirs:?", parentFile.getCanonicalPath(), parentFile.mkdirs() ); | ||
|
||
} | ||
} | ||
|
||
protected static void copyFile(String path, File baseFolder, String basePath ) { | ||
SafeFunction.apply( () -> { | ||
File outputFile = new File( baseFolder, path ); | ||
insureParent( outputFile ); | ||
String fullPath = basePath+path; | ||
log.info( "copy path '{}' to file '{}'", fullPath, outputFile.getCanonicalPath() ); | ||
try (InputStream is = ClassHelper.loadFromDefaultClassLoader( fullPath ); | ||
FileOutputStream os = new FileOutputStream( outputFile ) ) { | ||
|
||
StreamIO.pipeStream( is, os, StreamIO.MODE_CLOSE_NONE ); | ||
} | ||
} ); | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/PluginUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.fugerit.java.doc.project.facade; | ||
|
||
import org.apache.maven.model.Build; | ||
import org.apache.maven.model.Model; | ||
import org.apache.maven.model.Plugin; | ||
import org.apache.maven.model.PluginExecution; | ||
import org.codehaus.plexus.util.xml.Xpp3DomBuilder; | ||
import org.fugerit.java.core.io.helper.HelperIOException; | ||
|
||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.util.Arrays; | ||
|
||
public class PluginUtils { | ||
|
||
public static final String GOAL_DIRECT = "direct"; | ||
|
||
public static final String FJ_DOC_MAVEN_PLUGIN = "fj-doc-maven-plugin"; | ||
|
||
private PluginUtils() {} | ||
|
||
public static Object getPluginConfiguration( String xml ) throws IOException { | ||
return HelperIOException.get( () -> { | ||
try ( StringReader sr = new StringReader( xml ) ) { | ||
return Xpp3DomBuilder.build( sr ); | ||
} | ||
}); | ||
} | ||
|
||
public static Plugin findOrCreatePLugin( Model model ) { | ||
Plugin plugin = null; | ||
Build build = getBuild( model ); | ||
for ( Plugin current : build.getPlugins() ) { | ||
if ( FJ_DOC_MAVEN_PLUGIN.equals( current.getArtifactId() ) ) { | ||
plugin = current; | ||
} | ||
} | ||
if ( plugin == null ) { | ||
plugin = new Plugin(); | ||
plugin.setGroupId( VenusConsts.GROUP_ID ); | ||
plugin.setArtifactId( FJ_DOC_MAVEN_PLUGIN ); | ||
plugin.setVersion( "${"+VenusConsts.KEY_VERSION+"}" ); | ||
build.getPlugins().add( plugin ); | ||
} | ||
return plugin; | ||
} | ||
|
||
public static PluginExecution createPluginExecution(String id, String phase, String... goal ) { | ||
PluginExecution execution = new PluginExecution(); | ||
execution.setId( id ); | ||
execution.setPhase( phase ); | ||
execution.setGoals(Arrays.asList( goal )); | ||
return execution; | ||
} | ||
|
||
public static Build getBuild(Model model) { | ||
Build build = model.getBuild(); | ||
if ( build == null ) { | ||
build = new Build(); | ||
model.setBuild( build ); | ||
} | ||
return build; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.