@Test public void testPosts() throws Exception { File basedir = resources.getBasedir("posts"); MavenExecutionResult result = mavenRuntime .forProject(basedir) .execute("clean", "test"); result.assertErrorFreeLog(); }
@Override public void execute() { try { sourceDirectory = makeAbsolute(sourceDirectory); outputDirectory = makeAbsolute(outputDirectory); if ( ! sourceDirectory.exists() ) return; getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory + "\n\toutputDirectory=" + outputDirectory); ClassLoader cp = getCompileClassLoader(); ApiGen apiGen = new ApiGen.Builder() .withOutputDirectory(outputDirectory.toPath()) .withGuiceModuleName(guiceModuleName) .withDefaultPackageName(defaultPackageName) .build(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp); for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) { URL url = resource.getURL(); getLog().debug("Processing "+url); apiGen.addForReference(url); } findGraphql(sourceDirectory, apiGen::addForGeneration); apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql")); schemaResource.setDirectory(sourceDirectory.toString()); project.addResource(schemaResource); project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } catch (Exception e) { String msg = e.getMessage(); if ( null == msg ) msg = e.getClass().getName(); getLog().error(msg + " when trying to build sources from graphql.", e); } }
ApiGenMojo extends AbstractMojo { @Override public void execute() { try { sourceDirectory = makeAbsolute(sourceDirectory); outputDirectory = makeAbsolute(outputDirectory); if ( ! sourceDirectory.exists() ) return; getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory + "\n\toutputDirectory=" + outputDirectory); ClassLoader cp = getCompileClassLoader(); ApiGen apiGen = new ApiGen.Builder() .withOutputDirectory(outputDirectory.toPath()) .withGuiceModuleName(guiceModuleName) .withDefaultPackageName(defaultPackageName) .build(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp); for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) { URL url = resource.getURL(); getLog().debug("Processing "+url); apiGen.addForReference(url); } findGraphql(sourceDirectory, apiGen::addForGeneration); apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql")); schemaResource.setDirectory(sourceDirectory.toString()); project.addResource(schemaResource); project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } catch (Exception e) { String msg = e.getMessage(); if ( null == msg ) msg = e.getClass().getName(); getLog().error(msg + " when trying to build sources from graphql.", e); } } }
ApiGenMojo extends AbstractMojo { @Override public void execute() { try { sourceDirectory = makeAbsolute(sourceDirectory); outputDirectory = makeAbsolute(outputDirectory); if ( ! sourceDirectory.exists() ) return; getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory + "\n\toutputDirectory=" + outputDirectory); ClassLoader cp = getCompileClassLoader(); ApiGen apiGen = new ApiGen.Builder() .withOutputDirectory(outputDirectory.toPath()) .withGuiceModuleName(guiceModuleName) .withDefaultPackageName(defaultPackageName) .build(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp); for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) { URL url = resource.getURL(); getLog().debug("Processing "+url); apiGen.addForReference(url); } findGraphql(sourceDirectory, apiGen::addForGeneration); apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql")); schemaResource.setDirectory(sourceDirectory.toString()); project.addResource(schemaResource); project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } catch (Exception e) { String msg = e.getMessage(); if ( null == msg ) msg = e.getClass().getName(); getLog().error(msg + " when trying to build sources from graphql.", e); } }  }
ApiGenMojo extends AbstractMojo { @Override public void execute() { try { sourceDirectory = makeAbsolute(sourceDirectory); outputDirectory = makeAbsolute(outputDirectory); if ( ! sourceDirectory.exists() ) return; getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory + "\n\toutputDirectory=" + outputDirectory); ClassLoader cp = getCompileClassLoader(); ApiGen apiGen = new ApiGen.Builder() .withOutputDirectory(outputDirectory.toPath()) .withGuiceModuleName(guiceModuleName) .withDefaultPackageName(defaultPackageName) .build(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp); for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) { URL url = resource.getURL(); getLog().debug("Processing "+url); apiGen.addForReference(url); } findGraphql(sourceDirectory, apiGen::addForGeneration); apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql")); schemaResource.setDirectory(sourceDirectory.toString()); project.addResource(schemaResource); project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } catch (Exception e) { String msg = e.getMessage(); if ( null == msg ) msg = e.getClass().getName(); getLog().error(msg + " when trying to build sources from graphql.", e); } }  @Override void execute(); }
ApiGenMojo extends AbstractMojo { @Override public void execute() { try { sourceDirectory = makeAbsolute(sourceDirectory); outputDirectory = makeAbsolute(outputDirectory); if ( ! sourceDirectory.exists() ) return; getLog().debug("Running ApiGen\n\tsourceDirectory=" + sourceDirectory + "\n\toutputDirectory=" + outputDirectory); ClassLoader cp = getCompileClassLoader(); ApiGen apiGen = new ApiGen.Builder() .withOutputDirectory(outputDirectory.toPath()) .withGuiceModuleName(guiceModuleName) .withDefaultPackageName(defaultPackageName) .build(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cp); for ( org.springframework.core.io.Resource resource : resolver.getResources("classpath*:graphql-apigen-schema/*.graphql{,s}") ) { URL url = resource.getURL(); getLog().debug("Processing "+url); apiGen.addForReference(url); } findGraphql(sourceDirectory, apiGen::addForGeneration); apiGen.generate(); Resource schemaResource = new Resource(); schemaResource.setTargetPath("graphql-apigen-schema"); schemaResource.setFiltering(false); schemaResource.setIncludes(Arrays.asList("*.graphqls","*.graphql")); schemaResource.setDirectory(sourceDirectory.toString()); project.addResource(schemaResource); project.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } catch (Exception e) { String msg = e.getMessage(); if ( null == msg ) msg = e.getClass().getName(); getLog().error(msg + " when trying to build sources from graphql.", e); } }  @Override void execute();  }