CodeGenMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { CopyBookConverter converter = new CopyBookConverter(); Path outPath = Paths.get(outputPath.getCanonicalPath(), "generated-sources"); converter.convertFiles(inputPath.getCanonicalPath(), Pattern.compile(inputFilter), outPath.toString(), packageName, accessor, charset, subclass); if (addCompileSourceRoot) { project.addCompileSourceRoot(outputPath.toString()); } } catch (Exception e) { e.printStackTrace(); } }  void execute();  }
@Test public void testExecute() throws Exception { File pom = getTestFile( "../copybook4java-codegen-maven-test/pom.xml" ); assertNotNull(pom); assertTrue(pom.exists()); CodeGenMojo codeGenMojo = (CodeGenMojo)lookupConfiguredMojo("generate", pom); codeGenMojo.execute(); }