本文整理汇总了Java中org.apache.maven.reporting.MavenReportException类的典型用法代码示例。如果您正苦于以下问题:Java MavenReportException类的具体用法?Java MavenReportException怎么用?Java MavenReportException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MavenReportException类属于org.apache.maven.reporting包,在下文中一共展示了MavenReportException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
@Override
protected void executeReport(Locale locale) throws MavenReportException {
File selectedXmlReportFile;
if (xmlReportFile != null) {
selectedXmlReportFile = xmlReportFile;
} else {
selectedXmlReportFile = new File(project.getBuild().getDirectory() + "/" + ProjectResolver.OUTPUT_DIRECTORY + "/" + AbstractMojo.REPORT_XML);
}
if (selectedXmlReportFile.exists()) {
StringWriter writer = new StringWriter();
// Transform
Source xmlSource = new StreamSource(selectedXmlReportFile);
Result htmlTarget = new StreamResult(writer);
getLog().info("Transforming " + selectedXmlReportFile.getAbsolutePath() + ".");
ReportTransformer transformer = new HtmlReportTransformer();
try {
transformer.toEmbedded(xmlSource, htmlTarget);
} catch (ReportTransformerException e) {
throw new MavenReportException("Cannot transform report.", e);
}
getSink().rawText(writer.toString());
}
}
示例2: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
@Override
protected final void executeReport( final Locale p_locale ) throws MavenReportException
{
if ( ( imports == null ) || ( imports.length == 0 ) )
throw new MavenReportException( CCommon.languagestring( this, "importempty" ) );
final Tuple5<File, Set<ETemplate>, Set<File>, Set<String>, Set<String>> l_initdata = CMain.initialize(
p_locale.toLanguageTag(),
output,
templates,
imports,
excludes,
docclean
);
// --- run generator ---
final IGenerator l_generator = new CPlugin( this, NAME, l_initdata.v1(), new File( grammarbasedir ), l_initdata.v3(), l_initdata.v5(), l_initdata.v2() );
Arrays.stream( grammar )
.flatMap( i -> CMain.filelist( new File( i.trim() ), l_initdata.v3(), l_initdata.v4() ) )
.forEach( l_generator::generate );
l_generator.finish();
}
示例3: doGenerateReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
protected void doGenerateReport( Locale locale, Sink sink )
throws MavenReportException
{
final Map updateSet;
try
{
updateSet = getHelper().getVersionPropertiesMap( getProject(), properties, includeProperties,
excludeProperties, autoLinkItems );
}
catch ( MojoExecutionException e )
{
throw new MavenReportException( e.getMessage(), e );
}
PropertyUpdatesRenderer renderer =
new PropertyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, updateSet );
renderer.render();
}
示例4: getHelper
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
public VersionsHelper getHelper()
throws MavenReportException
{
if ( helper == null )
{
try
{
helper = new DefaultVersionsHelper( artifactFactory, artifactResolver, artifactMetadataSource,
remoteArtifactRepositories, remotePluginRepositories,
localRepository, wagonManager, settings, serverId, rulesUri,
getLog(), session, pathTranslator );
}
catch ( MojoExecutionException e )
{
throw new MavenReportException( e.getMessage(), e );
}
}
return helper;
}
示例5: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void executeReport( Locale locale )
throws MavenReportException
{
if ( !skip )
{
try
{
doGenerateReport( locale, getSink() );
}
catch ( MojoExecutionException e )
{
throw new MavenReportException( e.getMessage(), e );
}
}
}
示例6: findLatestVersion
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* Finds the latest version of the specified artifact that matches the version range.
*
* @param artifact The artifact.
* @param versionRange The version range.
* @param allowingSnapshots <code>null</code> for no override, otherwise the local override to apply.
* @return The latest version of the specified artifact that matches the specified version range or
* <code>null</code> if no matching version could be found.
* @throws MojoExecutionException If the artifact metadata could not be found.
* @since 1.0-alpha-1
*/
protected ArtifactVersion findLatestVersion( Artifact artifact, VersionRange versionRange,
boolean allowingSnapshots, boolean usePluginRepositories )
throws MavenReportException
{
boolean includeSnapshots = this.allowSnapshots;
if ( allowingSnapshots )
{
includeSnapshots = true;
}
if ( allowingSnapshots )
{
includeSnapshots = false;
}
try
{
final ArtifactVersions artifactVersions =
getHelper().lookupArtifactVersions( artifact, usePluginRepositories );
return artifactVersions.getNewestVersion( versionRange, includeSnapshots );
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new MavenReportException( e.getMessage(), e );
}
}
示例7: render
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* Makes report file with given name in target directory.
*
* @throws MavenReportException if something went wrong
*/
public void render()
throws MavenReportException
{
StringBuilder sb = new StringBuilder();
sb.append( "<DependencyUpdatesReport>" ).append( NL );
Map<Dependency, ArtifactVersions> allUpdates = new TreeMap<>( new DependencyComparator() );
allUpdates.putAll( dependencyManagementUpdates );
allUpdates.putAll( dependencyUpdates );
sb.append( getSummaryBlock( allUpdates.values() ) );
sb.append( getDependencyInfoBlock( dependencyManagementUpdates, "dependencyManagements",
"dependencyManagement" ) );
sb.append( getDependencyInfoBlock( dependencyUpdates, "dependencies", "dependency" ) );
sb.append( "</DependencyUpdatesReport>" ).append( NL );
PrintWriter pw;
try
{
pw = new PrintWriter( outputFileName, "UTF8" );
pw.print( sb.toString() );
pw.close();
}
catch ( IOException e )
{
throw new MavenReportException( "Cannot create xml report.", e );
}
}
示例8: render
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* Makes report file with given name in target directory.
*
* @throws MavenReportException if something went wrong
*/
public void render()
throws MavenReportException
{
StringBuilder sb = new StringBuilder();
sb.append( "<PluginUpdatesReport>" ).append( NL );
Map<Plugin, PluginUpdatesDetails> allUpdates =
new TreeMap<Plugin, PluginUpdatesDetails>( new PluginComparator() );
allUpdates.putAll( pluginManagementUpdates );
allUpdates.putAll( pluginUpdates );
sb.append( getSummaryBlock( allUpdates ) );
sb.append( getPluginsInfoBlock( pluginManagementUpdates, "pluginManagements", "pluginManagement" ) );
sb.append( getPluginsInfoBlock( pluginUpdates, "plugins", "plugin" ) );
sb.append( "</PluginUpdatesReport>" ).append( NL );
PrintWriter pw;
try
{
pw = new PrintWriter( outputFileName, "UTF8" );
pw.print( sb.toString() );
pw.close();
}
catch ( IOException e )
{
throw new MavenReportException( "Cannot create xml report.", e );
}
}
示例9: parse
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
public List<TestCase> parse(Path surefirePath) throws IOException {
SurefireReportParser
parser = new SurefireReportParser(Arrays.asList(surefirePath.toFile()),
Locale.ENGLISH);
List<ReportTestSuite> suites;
try {
suites = parser.parseXMLReportFiles();
} catch (MavenReportException e) {
throw new IOException("Failed to parse surefire reports", e);
}
return suites.stream()
.flatMap(suite -> suite.getTestCases().stream())
.map(testCase -> new TestCase(testCase.getFullName(), testCase.getFailure() == null,
parseTestFailure(testCase.getFailure())))
.collect(Collectors.toList());
}
示例10: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* @see AbstractMavenReport#executeReport(Locale)
*/
@Override
protected void executeReport(final Locale locale)
throws MavenReportException {
// TODO Auto-generated method stub
final Sink sink = getSink();
sink.head();
sink.title();
sink.text(getBundle(locale).getString("title"));
sink.title_();
sink.head_();
sink.body();
sink.body_();
sink.flush();
sink.close();
}
示例11: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* Entry point for the plugin report goal
*
* @param locale
*/
@Override
protected void executeReport(Locale locale) throws MavenReportException {
List<L10nReportItem> reportItems = new ArrayList<L10nReportItem>();
ValidateMojo validateMojo = new ValidateMojo(this);
validateMojo.setLog(getLog());
validateMojo.initialize();
int nbErrors = 0;
try {
nbErrors = validateMojo.validate(propertyDir, reportItems);
} catch (MojoExecutionException e) {
throw new MavenReportException("Could not exceute ValidateMojo", e);
}
reportRenderer = new L10nReportRenderer(getSink(), getBundle(locale));
reportRenderer.setReportItems(reportItems);
reportRenderer.setNbErrors(nbErrors);
reportRenderer.render();
}
示例12: generateReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
public void generateReport( Locale locale )
throws MavenReportException
{
Sink sink;
ReportGenerator report = new ReportGenerator();
try
{
sink = getSink();
report.doGenerateReport( getBundle( locale ), sink, xmlParser );
}
catch ( Exception e )
{
throw new MavenReportException( "Failed to generate JDepend report", e );
}
}
示例13: doGenerateReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
protected void doGenerateReport( Locale locale, Sink sink )
throws MavenReportException
{
final Map updateSet;
try
{
updateSet =
getHelper().getVersionPropertiesMap( getProject(), properties, includeProperties, excludeProperties,
!Boolean.FALSE.equals( autoLinkItems ) );
}
catch ( MojoExecutionException e )
{
throw new MavenReportException( e.getMessage(), e );
}
PropertyUpdatesRenderer renderer =
new PropertyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, updateSet );
renderer.render();
}
示例14: executeReport
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void executeReport( Locale locale )
throws MavenReportException
{
if ( !Boolean.TRUE.equals( skip ) )
{
try
{
doGenerateReport( locale, getSink() );
}
catch ( MojoExecutionException e )
{
throw new MavenReportException( e.getMessage(), e );
}
}
}
示例15: findLatestVersion
import org.apache.maven.reporting.MavenReportException; //导入依赖的package包/类
/**
* Finds the latest version of the specified artifact that matches the version range.
*
* @param artifact The artifact.
* @param versionRange The version range.
* @param allowingSnapshots <code>null</code> for no override, otherwise the local override to apply.
* @return The latest version of the specified artifact that matches the specified version range or
* <code>null</code> if no matching version could be found.
* @throws MojoExecutionException If the artifact metadata could not be found.
* @since 1.0-alpha-1
*/
protected ArtifactVersion findLatestVersion( Artifact artifact, VersionRange versionRange,
Boolean allowingSnapshots, boolean usePluginRepositories )
throws MavenReportException
{
boolean includeSnapshots = Boolean.TRUE.equals( this.allowSnapshots );
if ( Boolean.TRUE.equals( allowingSnapshots ) )
{
includeSnapshots = true;
}
if ( Boolean.FALSE.equals( allowingSnapshots ) )
{
includeSnapshots = false;
}
try
{
final ArtifactVersions artifactVersions =
getHelper().lookupArtifactVersions( artifact, usePluginRepositories );
return artifactVersions.getNewestVersion( versionRange, includeSnapshots );
}
catch ( ArtifactMetadataRetrievalException e )
{
throw new MavenReportException( e.getMessage(), e );
}
}