public void execute()

in activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/ProtoMojo.java [71:109]


    public void execute() throws MojoExecutionException {

        File[] files = sourceDirectory.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".proto");
            }
        });
        
        if (files==null || files.length==0) {
            getLog().warn("No proto files found in directory: " + sourceDirectory.getPath());
            return;
        }
        
        List<File> recFiles = Arrays.asList(files);
        for (File file : recFiles) {
            try {
                getLog().info("Compiling: "+file.getPath());
                if( "default".equals(type) ) {
                    JavaGenerator generator = new JavaGenerator();
                    generator.setOut(outputDirectory);
                    generator.compile(file);
                } else if( "alt".equals(type) ) {
                    AltJavaGenerator generator = new AltJavaGenerator();
                    generator.setOut(outputDirectory);
                    generator.compile(file);
                }
            } catch (CompilerException e) {
                getLog().error("Protocol Buffer Compiler failed with the following error(s):");
                for (String error : e.getErrors() ) {
                    getLog().error("");
                    getLog().error(error);
                }
                getLog().error("");
                throw new MojoExecutionException("Compile failed.  For more details see error messages listed above.", e);
            }
        }

        this.project.addCompileSourceRoot(outputDirectory.getAbsolutePath());
    }