private void writeReporting(Reporting reporting, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (reporting.getExcludeDefaults() != null) { writeValue(serializer, "excludeDefaults", reporting.getExcludeDefaults(), reporting); } if (reporting.getOutputDirectory() != null) { writeValue(serializer, "outputDirectory", reporting.getOutputDirectory(), reporting); } if ((reporting.getPlugins() != null) && (reporting.getPlugins().size() > 0)) { serializer.startTag(NAMESPACE, "plugins"); for (Iterator iter = reporting.getPlugins().iterator(); iter.hasNext();) { ReportPlugin o = (ReportPlugin) iter.next(); writeReportPlugin(o, "plugin", serializer); } serializer.endTag(NAMESPACE, "plugins"); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(reporting, "", start, b.length()); }
private void visitProfileReporting( ModelVisitor visitor, Reporting reporting ) { List<ReportPlugin> plugins = reporting.getPlugins(); if ( plugins != null ) { ListIterator<ReportPlugin> pluginIterator = plugins.listIterator(); while ( pluginIterator.hasNext() ) { ReportPlugin plugin = pluginIterator.next(); visitor.visitProfileReportingPlugin( plugin ); visitProfileReportingPlugin( visitor, plugin ); plugin = visitor.replaceProfileReportingPlugin( plugin ); if ( plugin == null ) pluginIterator.remove(); else pluginIterator.set( plugin ); } } }
private void visitReporting( ModelVisitor visitor, Reporting reporting ) { List<ReportPlugin> plugins = reporting.getPlugins(); if ( plugins != null ) { ListIterator<ReportPlugin> pluginIterator = plugins.listIterator(); while ( pluginIterator.hasNext() ) { ReportPlugin plugin = pluginIterator.next(); visitor.visitReportingPlugin( plugin ); visitReportingPlugin( visitor, plugin ); plugin = visitor.replaceReportingPlugin( plugin ); if ( plugin == null ) pluginIterator.remove(); else pluginIterator.set( plugin ); } } }
public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { Reporting reporting = model.getReporting(); if ( reporting != null ) { for ( ReportPlugin reportPlugin : reporting.getPlugins() ) { Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration(); if ( parentDom != null ) { for ( ReportSet execution : reportPlugin.getReportSets() ) { Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration(); childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) ); execution.setConfiguration( childDom ); } } } } }
/** * Method updateReporting * * @param value * @param element * @param counter * @param xmlTag */ protected void updateReporting( Reporting value, String xmlTag, Counter counter, Element element ) { boolean shouldExist = value != null; Element root = updateElement( counter, element, xmlTag, shouldExist ); if ( shouldExist ) { Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "excludeDefaults", !value.isExcludeDefaults() ? null : String.valueOf( value.isExcludeDefaults() ), "false" ); findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null ); iterateReportPlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" ); } }
protected void mergeReporting( Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context ) { mergeReporting_OutputDirectory( target, source, sourceDominant, context ); mergeReporting_ExcludeDefaults( target, source, sourceDominant, context ); mergeReporting_Plugins( target, source, sourceDominant, context ); }
protected void mergeReporting_OutputDirectory( Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getOutputDirectory(); if ( src != null ) { if ( sourceDominant || target.getOutputDirectory() == null ) { target.setOutputDirectory( src ); target.setLocation( "outputDirectory", source.getLocation( "outputDirectory" ) ); } } }
protected void mergeReporting_ExcludeDefaults( Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getExcludeDefaults(); if ( src != null ) { if ( sourceDominant || target.getExcludeDefaults() == null ) { target.setExcludeDefaults( src ); target.setLocation( "excludeDefaults", source.getLocation( "excludeDefaults" ) ); } } }
public Reporting getReporting() { return null; }
/** * Returns a plugin from a pom based on its group id and artifact id * <p> * It searches in the build section, then the reporting section and finally the pluginManagement section * </p> * * @param pom the project pom * @param groupId the plugin group id * @param artifactId the plugin artifact id * @return the plugin if it exists, null otherwise */ @CheckForNull public static MavenPlugin getPlugin(MavenProject pom, String groupId, String artifactId) { Object pluginConfiguration = null; // look for plugin in <build> section Plugin plugin = getPlugin(pom.getBuildPlugins(), groupId, artifactId); if (plugin != null) { pluginConfiguration = plugin.getConfiguration(); } else { // look for plugin in reporting Reporting reporting = pom.getModel().getReporting(); if (reporting != null) { ReportPlugin reportPlugin = getReportPlugin(reporting.getPlugins(), groupId, artifactId); if (reportPlugin != null) { pluginConfiguration = reportPlugin.getConfiguration(); } } } // look for plugin in <pluginManagement> section PluginManagement pluginManagement = pom.getPluginManagement(); if (pluginManagement != null) { Plugin pluginFromManagement = getPlugin(pluginManagement.getPlugins(), groupId, artifactId); if (pluginFromManagement != null) { Object pluginConfigFromManagement = pluginFromManagement.getConfiguration(); if (pluginConfiguration == null) { pluginConfiguration = pluginConfigFromManagement; } else if (pluginConfigFromManagement != null) { Xpp3Dom.mergeXpp3Dom((Xpp3Dom) pluginConfiguration, (Xpp3Dom) pluginConfigFromManagement); } } } if (pluginConfiguration != null) { return new MavenPlugin(pluginConfiguration); } return null; }
@Override public Reporting replaceProfileReporting( Reporting reporting ) { return reporting; }
@Override public Reporting replaceReporting( Reporting reporting ) { return reporting; }
@Override public void visitProfileReporting( Reporting reporting ) { }
@Override public void visitReporting( Reporting reporting ) { }
@Override public Reporting get( Model model ) { return model.getReporting(); }
@Override public void set( Model model, Reporting value ) { model.setReporting( value ); }
public CreateSpdxMavenProjectStub() { MavenXpp3Reader pomReader = new MavenXpp3Reader(); Model model; try { model = pomReader.read( ReaderFactory.newXmlReader( new File( getBasedir(), "pom.xml" ) ) ); setModel( model ); } catch ( Exception e ) { throw new RuntimeException( e ); } setGroupId( model.getGroupId() ); setArtifactId( model.getArtifactId() ); setVersion( model.getVersion() ); setName( model.getName() ); setUrl( model.getUrl() ); setPackaging( model.getPackaging() ); Build build = new Build(); build.setFinalName( model.getArtifactId() ); build.setDirectory( getBasedir() + "/target" ); build.setSourceDirectory( getBasedir() + "/src/main/java" ); build.setOutputDirectory( getBasedir() + "/target/classes" ); build.setTestSourceDirectory( getBasedir() + "/src/test/java" ); build.setTestOutputDirectory( getBasedir() + "/target/test-classes" ); setBuild( build ); Reporting reporting = new Reporting(); reporting.setOutputDirectory( getBaseDir() + "/target/site" ); setReporting( reporting ); List<String> compileSourceRoots = new ArrayList<String>(); compileSourceRoots.add( getBasedir() + "/src/main/java" ); setCompileSourceRoots( compileSourceRoots ); List<String> testCompileSourceRoots = new ArrayList<String>(); testCompileSourceRoots.add( getBasedir() + "/src/test/java" ); setTestCompileSourceRoots( testCompileSourceRoots ); }
@Deprecated public void setReporting( Reporting reporting ) { getModel().setReporting( reporting ); }
@Deprecated public Reporting getReporting() { return getModel().getReporting(); }
@Override public void setReporting(final Reporting reporting) { getDelegate().setReporting(reporting); }
@Override public Reporting getReporting() { return getDelegate().getReporting(); }
public void setReporting( Reporting reporting ) { }
Reporting replaceProfileReporting( Reporting reporting );
Reporting replaceReporting( Reporting reporting );
void visitProfileReporting( Reporting reporting );
void visitReporting( Reporting reporting );