Package org.apache.maven.plugin

Examples of org.apache.maven.plugin.MojoFailureException


                    if (artifact != null)
                    {
                        final String path = cartridgeArtifact.getPath();
                        if (path == null || path.trim().length() == 0)
                        {
                            throw new MojoFailureException("Please specify the 'path' for the cartridge artifact [" +
                                cartridgeArtifact.getGroupId() + ":" + cartridgeArtifact.getArtifactId() + ":" +
                                cartridgeArtifact.getType() + "]");
                        }

                        final File destinationDirectory = new File(outputDirectory,
View Full Code Here


            final String groupId = cartridgeArtifact.getGroupId();
            final String artifactId = cartridgeArtifact.getArtifactId();
            final String type = cartridgeArtifact.getType();
            if (groupId == null || artifactId == null)
            {
                throw new MojoFailureException("Could not resolve cartridge artifact [" + groupId + ":" + artifactId +
                    ":" + type + "]");
            }

            for (final Iterator iterator = artifacts.iterator(); iterator.hasNext();)
            {
                final Artifact artifact = (Artifact)iterator.next();
                if (artifact.getGroupId().equals(groupId) && artifact.getArtifactId().equals(artifactId) &&
                    (type == null || artifact.getType().equals(type)))
                {
                    resolvedArtifact = artifact;
                    break;
                }
            }

            if (resolvedArtifact == null)
            {
                // Artifact has not been found
                throw new MojoFailureException("Artifact[" + groupId + ":" + artifactId + ":" + type + "] " +
                    "is not a dependency of the project.");
            }
            return resolvedArtifact;
        }
        return resolvedArtifact;
View Full Code Here

            this.updateBuildContext(result);

        } catch (final SCRDescriptorException sde) {
            throw new MojoExecutionException(sde.getSourceLocation() + " : " + sde.getMessage(), sde);
        } catch (final SCRDescriptorFailureException sdfe) {
            throw (MojoFailureException) new MojoFailureException(
                    sdfe.getMessage()).initCause(sdfe);
        }
    }
View Full Code Here

        try {
            path.add(new File(this.project.getBuild().getOutputDirectory())
            .toURI().toURL());
        } catch (final IOException ioe) {
            throw new MojoFailureException(
                    "Unable to add target directory to classloader.");
        }

        for (final Iterator<Artifact> ai = artifacts.iterator(); ai.hasNext();) {
            final Artifact a = ai.next();
            assertMinScrAnnotationArtifactVersion(a);
            try {
                path.add(a.getFile().toURI().toURL());
            } catch (IOException ioe) {
                throw new MojoFailureException(
                        "Unable to get compile class loader.");
            }
        }

        return path.toArray(new URL[path.size()]);
View Full Code Here

            final ArtifactVersion aVersion = new DefaultArtifactVersion(a.getBaseVersion());
            if (SCR_ANN_MIN_VERSION.compareTo(aVersion) > 0) {
                getLog().error("Project depends on " + a);
                getLog().error(
                        "Minimum required version is " + SCR_ANN_MIN_VERSION);
                throw new MojoFailureException(
                        "Please use org.apache.felix:org.apache.felix.scr.annotations version "
                                + SCR_ANN_MIN_VERSION + " or newer.");
            }
        }
    }
View Full Code Here

            if ( stopOnFailure ) {
                if ( e instanceof MojoExecutionException ) {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
                else if ( e instanceof MojoFailureException ) {
                    MojoFailureException x = new MojoFailureException(e.getMessage());
                    x.initCause(e);
                    throw x;
                }
                else {
                    throw new MojoExecutionException(e.getMessage(), e);
                }
View Full Code Here

        if ( files.size() > 0 )
        {
            document = insertNewColumn(document);
            if ( document == null )
            {
                throw new MojoFailureException("Main table cannot be found in the " + resultsFileName + ". The file may be corrupted");
            }
        }

        for ( Iterator itr=files.iterator(); itr.hasNext(); )
        {
View Full Code Here

                        String
                                .format("     %s:%s:%s", bundle.getGroupId(), bundle.getArtifactId(), bundle
                                        .getVersion()));
            }
            if (failOnSnapshot) {
                throw new MojoFailureException("SNAPSHOTs were found in the bundle list. See log.");
            }
        }
    }
View Full Code Here

                throw new MojoExecutionException("Unable to read bundle list file", e);
            } catch (XmlPullParserException e) {
                throw new MojoExecutionException("Unable to read bundle list file", e);
            }
        } else {
            throw new MojoFailureException(String.format("Bundle list file %s does not exist.", bundleListFile.getAbsolutePath()));
        }

        interpolateProperties(initializedBundleList, this.project, this.mavenSession);

        final BundleListXpp3Writer writer = new BundleListXpp3Writer();
View Full Code Here

    public void execute() throws MojoExecutionException, MojoFailureException {
        // if project is of type "pom", throw an error
        if (project.getPackaging().equalsIgnoreCase("pom")) {
            String errorMsg = "[ERROR] This plugin cannot be run from a pom project, please run it from a jar or war project (i.e. core or web).";
            //getLog().error(errorMsg);
            throw new MojoFailureException(errorMsg);
        }

        String pojoName = System.getProperty("entity");

        if (pojoName == null) {
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.MojoFailureException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.