private void configureRunTask(final Project project) { final JavaExec run = (JavaExec) project.getTasks().findByName(ApplicationPlugin.TASK_RUN_NAME); final JavaModule module = (JavaModule) project.getExtensions().getByName(EXTENSION_NAME); run.getInputs().property("moduleName", module.geName()); run.doFirst(new Action<Task>() { @Override public void execute(Task task) { List<String> args = new ArrayList<>(); args.add("--module-path"); args.add(run.getClasspath().getAsPath()); args.add("--module"); args.add(module.geName() + "/" + run.getMain()); run.setJvmArgs(args); run.setClasspath(project.files()); } }); }
private void configureAppPlugin() { final ApplicationPluginConvention convention = this.project.getConvention().findPlugin( ApplicationPluginConvention.class ); convention.setMainClassName( "io.purplejs.boot.MainApp" ); final JavaExec runTask = (JavaExec) this.project.getTasks().getByName( ApplicationPlugin.TASK_RUN_NAME ); runTask.systemProperty( "io.purplejs.runMode", "dev" ); final String devDirs = new File( this.project.getProjectDir(), "src/main/resources" ).getAbsolutePath(); runTask.systemProperty( "io.purplejs.devSourceDirs", devDirs ); }
@Override public void apply(Project project) { project.getPluginManager().apply(ApplicationPlugin.class); project.getPluginManager().apply(GitPropertiesPlugin.class); project .getExtensions() .create(ImmutableDeploymentExtension.NAME, DeploymentExtension.class, project); project.getNormalization().getRuntimeClasspath().ignore("git.properties"); project.afterEvaluate( p -> { ImmutableDeploymentExtension config = project.getExtensions().getByType(DeploymentExtension.class); String archivesBaseName = project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName(); project .getConvention() .getPlugin(ApplicationPluginConvention.class) .setApplicationName(archivesBaseName); GroovyObject docker = project.getExtensions().getByType(DockerExtension.class); DockerJavaApplication javaApplication = (DockerJavaApplication) docker.getProperty("javaApplication"); javaApplication.setBaseImage("openjdk:8-jre"); project.getTasks().getByName("build").dependsOn("dockerDistTar"); for (ImmutableDeploymentConfiguration type : config.getTypes()) { String capitalized = Ascii.toUpperCase(type.getName().charAt(0)) + type.getName().substring(1); DeployConfigMapTask deployConfigMapTask = project .getTasks() .create("deployConfigMap" + capitalized, DeployConfigMapTask.class) .setType(type.getName()); project .getTasks() .create("deploy" + capitalized, DeployPodTask.class) .setType(type.getName()) .dependsOn(deployConfigMapTask); } }); project.getPluginManager().apply(DockerJavaApplicationPlugin.class); }
private void addPlugins() { this.project.getPlugins().apply( JavaPlugin.class ); this.project.getPlugins().apply( ApplicationPlugin.class ); }
@Test public void applicationPlugin() { assertThat( project.getPlugins().findPlugin( ApplicationPlugin.class ), notNullValue() ); }