@Override public void execute() throws MojoExecutionException, MojoFailureException { project.addCompileSourceRoot(generatedSourceDirectory); ImmutableSet<String> protoPathsSet = ImmutableSet.copyOf(protoPaths); ImmutableSet<String> protoFilesSet = ImmutableSet.copyOf(protoFiles); IdentifierSet identifierSet = identifierSet(); try { CodegenSample codeGenerator = new CodegenSample( this, protoPathsSet, protoFilesSet, generatedSourceDirectory, identifierSet); codeGenerator.execute(); } catch (IOException e) { throw new MojoExecutionException("failed to generate sources", e); } }
/** * Extract the source dependencies. * * @throws MojoExecutionException if it fails. */ protected void extractSourceDependencies() throws MojoExecutionException { for ( Artifact artifact : getDirectDependencyArtifacts() ) { String type = artifact.getType(); if ( type.equals( APKSOURCES ) ) { getLog().debug( "Detected apksources dependency " + artifact + " with file " + artifact.getFile() + ". Will resolve and extract..." ); final File apksourcesFile = resolveArtifactToFile( artifact ); getLog().debug( "Extracting " + apksourcesFile + "..." ); extractApksources( apksourcesFile ); } } if ( extractedDependenciesJavaResources.exists() ) { projectHelper.addResource( project, extractedDependenciesJavaResources.getAbsolutePath(), null, null ); project.addCompileSourceRoot( extractedDependenciesJavaSources.getAbsolutePath() ); } }
project.addCompileSourceRoot( genDirectoryAidl.getPath() ); Set<File> sourceDirs = files.keySet(); for ( File sourceDir : sourceDirs )
this.project.addCompileSourceRoot(GsCollectionsCodeGenerator.GENERATED_SOURCES_LOCATION);
/** * Extracts ApkLib and adds the assets and apklib sources and resources to the build. */ private void extractApklib( Artifact apklibArtifact ) throws MojoExecutionException { getUnpackedLibHelper().extractApklib( apklibArtifact ); // Copy the assets to the the combinedAssets folder. // Add the apklib source and resource to the compile. // NB apklib sources are added to compileSourceRoot because we may need to compile against them. // This means the apklib classes will be compiled into target/classes and packaged with this build. copyFolder( getUnpackedLibAssetsFolder( apklibArtifact ), combinedAssets ); final File apklibSourceFolder = getUnpackedApkLibSourceFolder( apklibArtifact ); final List<String> resourceExclusions = Arrays.asList( "**/*.java", "**/*.aidl" ); projectHelper.addResource( project, apklibSourceFolder.getAbsolutePath(), null, resourceExclusions ); project.addCompileSourceRoot( apklibSourceFolder.getAbsolutePath() ); }
@Override public void execute(Speedment speedment) throws MojoExecutionException, MojoFailureException { getLog().info("Generating code using JSON configuration file: '" + configLocation().toAbsolutePath() + "'."); if (hasConfigFile()) { try { final Project project = speedment.getOrThrow(ProjectComponent.class).getProject(); speedment.getOrThrow(TranslatorManager.class).accept(project); // after generating the speedment code, the package location needs to be added as a source folder if (!mavenProject.getCompileSourceRoots().contains(mavenProject.getBasedir().getAbsolutePath() + "/" + project.getPackageLocation())) { System.out.println("adding new source location"); mavenProject.addCompileSourceRoot(mavenProject.getBasedir().getAbsolutePath() + "/" + project.getPackageLocation()); } } catch (final Exception ex) { final String err = "Error parsing configFile file."; LOGGER.error(ex, err); getLog().error(err); throw new MojoExecutionException(err, ex); } } else { final String err = "To run speedment:generate a valid configFile needs to be specified."; getLog().error(err); throw new MojoExecutionException(err); } }
project.addCompileSourceRoot(outputDirectory.getPath());
this.project.addCompileSourceRoot(EclipseCollectionsCodeGenerator.GENERATED_SOURCES_LOCATION);
project.addCompileSourceRoot(targetDirectory);
project.addCompileSourceRoot(outputDirectory.getAbsolutePath());
project.addCompileSourceRoot(outputPath); break; case "test":
@Override public void execute() throws MojoExecutionException, MojoFailureException { project.addCompileSourceRoot(generatedSourceDirectory);
project.addCompileSourceRoot(m.getOutputDir().getAbsolutePath()); project.addCompileSourceRoot(m.getOutputDir().getAbsolutePath());
@Override protected void addCompileSourceRoot(String path) { project.addCompileSourceRoot(path); } }
project.addCompileSourceRoot( build.getSourceDirectory() );
public void execute() throws MojoExecutionException { generateCode(C2jModels.builder() .codeGenConfig(loadCodeGenConfig()) .customizationConfig(loadCustomizationConfig()) .serviceModel(loadServiceModel()) // Maven plugin doesn't support Waiters .waitersModel(Waiters.NONE) .examplesModel(loadExamplesModel()) .build()); project.addCompileSourceRoot(outputDirectory); }
public void execute() { for (File source : sources) { this.project.addCompileSourceRoot(source.getAbsolutePath()); } } }
project.addCompileSourceRoot( genDirectory.getAbsolutePath() );
project.addCompileSourceRoot( build.getSourceDirectory() ); project.addTestCompileSourceRoot( build.getTestSourceDirectory() );
@Override public void doExecute(Configuration configuration) throws MojoExecutionException, MojoFailureException { File packageDirectoryBase = configuration.getPackageDirectoryBase(); packageDirectoryBase.mkdirs(); ResourceGeneratorUsingModel gen = new ResourceGeneratorUsingModel(configuration.getVersion(), configuration.getBaseDir()); gen.setBaseResourceNames(configuration.getResourceNames()); try { gen.parse(); gen.setFilenameSuffix(filenameSuffix); gen.setFilenamePrefix(filenamePrefix); gen.setTemplate(templateName); gen.writeAll(packageDirectoryBase, null, configuration.getPackageBase()); } catch (Exception e) { throw new MojoFailureException("Failed to generate server", e); } myProject.addCompileSourceRoot(configuration.getTargetDirectory().getAbsolutePath()); }