Refine search
protected void alertAndStopExecutionIfDirectoryWithCompiledClassesOfThisProjectDoesNotExist( String directoryWithCompiledClassesOfThisProject) throws MojoExecutionException { File classesDir = null; if (directoryWithCompiledClassesOfThisProject != null) { classesDir = new File(directoryWithCompiledClassesOfThisProject); } if (classesDir == null || !classesDir.exists()) { getLog().error("Directory with classes does not exist: " + directoryWithCompiledClassesOfThisProject); getLog().error("Maybe running 'mvn compile' before running 'mvn ninja:run' helps :)"); // BAM! //System.exit(1); throw new MojoExecutionException("Directory with classes does not exist: " + directoryWithCompiledClassesOfThisProject); } } }
private static void requireValidDockerFilePath(@Nonnull Log log, @Nonnull Path contextDirectory, @Nullable Path dockerfile) throws MojoFailureException { log.info("Path(dockerfile): " + dockerfile); log.info("Path(contextDirectory): " + contextDirectory); if (dockerfile == null && !Files.exists(contextDirectory.resolve("Dockerfile")) && !Files.exists(contextDirectory.resolve("dockerfile"))) { // user did not override the default value log.error("Missing Dockerfile in context directory: " + contextDirectory); throw new MojoFailureException("Missing Dockerfile in context directory: " + contextDirectory); } if (dockerfile != null) { if (!Files.exists(dockerfile)) { log.error("Missing Dockerfile at " + dockerfile); throw new MojoFailureException("Missing Dockerfile at " + dockerfile); } if (!dockerfile.startsWith(contextDirectory)) { log.error("Dockerfile " + dockerfile + " is not a child of the context directory: " + contextDirectory); throw new MojoFailureException("Dockerfile " + dockerfile + " is not a child of the context directory: " + contextDirectory); } } }
@Override public void run() { if (watcher != null) { log.debug("stopping: watcher"); Try.run(watcher::stop).onFailure(ex -> log.debug("Stop of watcher resulted in error", ex)); } commands.forEach(cmd -> { log.debug("stopping: " + cmd); Try.run(cmd::stop).onFailure(ex -> log.error("Stop of " + cmd + " resulted in error", ex)); }); } }
@Override protected void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException { getLog().info("Saving default configuration from database to '" + configLocation().toAbsolutePath() + "'."); final ConfigFileHelper helper = speedment.getOrThrow(ConfigFileHelper.class); try { helper.setCurrentlyOpenFile(configLocation().toFile()); helper.loadFromDatabaseAndSaveToFile(); } catch (final Exception ex) { final String err = "An error occured while reloading."; getLog().error(err); throw new MojoExecutionException(err, ex); } }
/** * Copy the Ndk GdbServer into the architecture output folder if the folder exists but the GdbServer doesn't. */ private void copyGdbServer( File destinationDirectory, String architecture ) throws MojoExecutionException { try { final File destDir = new File( destinationDirectory, architecture ); if ( destDir.exists() ) { // Copy the gdbserver binary to libs/<architecture>/ final File gdbServerFile = getAndroidNdk().getGdbServer( architecture ); final File destFile = new File( destDir, "gdbserver" ); if ( ! destFile.exists() ) { getLog().debug( "Copying gdbServer to " + destFile ); FileUtils.copyFile( gdbServerFile, destFile ); } else { getLog().info( "Note: gdbserver binary already exists at destination, will not copy over" ); } } } catch ( Exception e ) { getLog().error( "Error while copying gdbserver: " + e.getMessage(), e ); throw new MojoExecutionException( "Error while copying gdbserver: " + e.getMessage(), e ); } }
private void generateBuildConfigForPackage( String packageName ) throws MojoExecutionException getLog().debug( "Creating BuildConfig for " + packageName ); getLog().error( "Error generating BuildConfig ", e ); throw new MojoExecutionException( "Error generating BuildConfig", e );
protected XSDSchema schema() { getLog().info( artifactFactory.toString() ); getLog().error( schemaSourceDirectory.getAbsolutePath() + " does not exist" ); return null; getLog().error( "Could not locate schema: " + schemaLocation.getName() ); return null; sb.append( u.next().toString() ); getLog().debug(sb.toString()); getLog().debug(e); xsds.set( i , null ); getLog().info("Parsing schema: " + schemaLocation); if (relativeSchemaReference) { xsdSchema = Schemas.parse(schemaLocation.getAbsolutePath(), Collections.EMPTY_LIST, getLog().error( "Failed to parse schema"); getLog().error( e ); return null;
@Override protected void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException { getLog().info("Saving default configuration from database to '" + configLocation().toAbsolutePath() + "'."); final ConfigFileHelper helper = speedment.getOrThrow(ConfigFileHelper.class); try { helper.setCurrentlyOpenFile(configLocation().toFile()); helper.clearTablesAndSaveToFile(); } catch (final Exception ex) { final String err = "An error occured while reloading."; getLog().error(err); throw new MojoExecutionException(err, ex); } }
protected final boolean hasConfigFile(Path file) { if (file == null) { final String msg = "The expected .json-file is null."; getLog().info(msg); return false; } else if (!Files.exists(file)) { final String msg = "The expected .json-file '" + file + "' does not exist."; getLog().info(msg); return false; } else if (!Files.isReadable(file)) { final String err = "The expected .json-file '" + file + "' is not readable."; getLog().error(err); return false; } else { return true; } }
/** * Check whether the artifact includes a BuildConfig located in a given package. * * @param artifact an AAR artifact to look for BuildConfig in * @param packageName BuildConfig package name * @throws MojoExecutionException */ private boolean isBuildConfigPresent( Artifact artifact, String packageName ) throws MojoExecutionException { try { JarFile jar = new JarFile( getUnpackedAarClassesJar( artifact ) ); JarEntry entry = jar.getJarEntry( packageName.replace( '.', '/' ) + "/BuildConfig.class" ); return ( entry != null ); } catch ( IOException e ) { getLog().error( "Error generating BuildConfig ", e ); throw new MojoExecutionException( "Error generating BuildConfig", e ); } }
getLog().debug( "copyManifest: " + androidManifestFile + " -> " + destinationManifestFile ); if ( androidManifestFile == null ) getLog().debug( "Manifest copying disabled. Using default manifest only" ); return; getLog().info( "Manifest copied from " + androidManifestFile + " to " + destinationManifestFile ); getLog().error( "Error during copyManifest" ); throw new MojoExecutionException( "Error during copyManifest", e );
private void copyLocalNativeLibraries( final File localNativeLibrariesDirectory, final File destinationDirectory ) throws MojoExecutionException { getLog().debug( "Copying existing native libraries from " + localNativeLibrariesDirectory ); try { IOFileFilter libSuffixFilter = FileFilterUtils.suffixFileFilter( ".so" ); IOFileFilter gdbserverNameFilter = FileFilterUtils.nameFileFilter( "gdbserver" ); IOFileFilter orFilter = FileFilterUtils.or( libSuffixFilter, gdbserverNameFilter ); IOFileFilter libFiles = FileFilterUtils.and( FileFileFilter.FILE, orFilter ); FileFilter filter = FileFilterUtils.or( DirectoryFileFilter.DIRECTORY, libFiles ); org.apache.commons.io.FileUtils .copyDirectory( localNativeLibrariesDirectory, destinationDirectory, filter ); } catch ( IOException e ) { getLog().error( "Could not copy native libraries: " + e.getMessage(), e ); throw new MojoExecutionException( "Could not copy native dependency.", e ); } }
getLog().error("Unable to resolve system scoped dependency: " + dependencyNode.toNodeString()); if (exCol == null) { exCol = new ExceptionCollection(); result = artifactResolver.resolveArtifact(buildingRequest, coordinate).getArtifact(); } catch (ArtifactResolverException ex) { getLog().debug(String.format("Aggregate : %s", aggregate)); boolean addException = true; if (!aggregate || addReactorDependency(engine, dependencyNode.getArtifact())) { getLog().debug(String.format("Adding project reference %s on dependency %s", project.getName(), d.getDisplayFileName())); } else if (getLog().isDebugEnabled()) { final String msg = String.format("More than 1 dependency was identified in first pass scan of '%s' in project %s", dependencyNode.getArtifact().getId(), project.getName()); getLog().debug(msg);
@Override public void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException { getLog().info("Clear any unmodified files generated using configuration file: '" + configLocation().toAbsolutePath() + "'."); if (hasConfigFile()) { try { final Project project = speedment.getOrThrow(ProjectComponent.class).getProject(); speedment.getOrThrow(TranslatorManager.class).clearExistingFiles(project); } catch (final Exception ex) { final String err = "Error parsing configFile file."; getLog().error(err); throw new MojoExecutionException(err, ex); } } else { final String err = "To run speedment:clear a valid configFile needs to be specified."; getLog().error(err); throw new MojoExecutionException(err); } }
/** * Returns if the specified file is non-null, exists and is readable. If, * not, {@code false} is returned and an appropriate message is shown in the * console. * * @param file the config file to check * @return {@code true} if available, else {@code false} */ protected final boolean hasConfigFile(Path file) { if (file == null) { final String msg = "The expected .json-file is null."; getLog().info(msg); return false; } else if (!Files.exists(file)) { final String msg = "The expected .json-file '" + file + "' does not exist."; getLog().info(msg); return false; } else if (!Files.isReadable(file)) { final String err = "The expected .json-file '" + file + "' is not readable."; getLog().error(err); return false; } else { return true; } }
@Override public void execute() throws MojoExecutionException, MojoFailureException { try { internalExecute(); } catch (Throwable th) { if (th instanceof MojoExecutionException) { throw (MojoExecutionException) th; } if (th instanceof MojoFailureException) { throw (MojoFailureException) th; } Throwable cause = th; int lcv = 0; while (cause != null) { getLog().error("Exception from hk2-config-generator[" + lcv++ + "]=" + cause.getMessage()); cause.printStackTrace(); cause = cause.getCause(); } throw new MojoExecutionException(th.getMessage(), th); } }
try { if (log.isDebugEnabled()) { log.debug("classPath: " + classPath); log.debug("classPaths: " + Arrays.deepToString(classPaths)); log.debug("buildPath: " + buildPath); log.debug("buildPaths: " + Arrays.deepToString(buildPaths)); log.debug("buildResource: " + buildResource); log.info("Skipping execution of JavaCPP Builder"); return; Properties properties = builder.properties; String extension = properties.getProperty("platform.extension"); log.info("Detected platform \"" + Loader.getPlatform() + "\""); log.info("Building for platform \"" + properties.get("platform") + "\"" + (extension != null && extension.length() > 0 ? " with extension \"" + extension + "\"" : "")); String separator = properties.getProperty("platform.path.separator"); log.error("Failed to execute JavaCPP Builder: " + e.getMessage()); throw new MojoExecutionException("Failed to execute JavaCPP Builder", e);
final String msg = String.format("Fatal exception(s) analyzing %s", getProject().getName()); if (this.isFailOnError()) { throw new MojoExecutionException(msg, returnEx); getLog().error(msg); if (getLog().isDebugEnabled()) { getLog().debug(returnEx); getLog().debug(msg, returnEx);