• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WarPlugin类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gradle.api.plugins.WarPlugin的典型用法代码示例。如果您正苦于以下问题:Java WarPlugin类的具体用法?Java WarPlugin怎么用?Java WarPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WarPlugin类属于org.gradle.api.plugins包,在下文中一共展示了WarPlugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configureAbstractJettyTask

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
private void configureAbstractJettyTask(final Project project, final JettyPluginConvention jettyConvention, AbstractJettyRunTask jettyTask) {
    jettyTask.setDaemon(false);
    jettyTask.setReload(RELOAD_AUTOMATIC);
    jettyTask.setScanIntervalSeconds(0);
    jettyTask.getConventionMapping().map("contextPath", new Callable<Object>() {
        public Object call() throws Exception {
            return ((War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME)).getBaseName();
        }
    });
    jettyTask.getConventionMapping().map("httpPort", new Callable<Object>() {
        public Object call() throws Exception {
            return jettyConvention.getHttpPort();
        }
    });
    jettyTask.getConventionMapping().map("stopPort", new Callable<Object>() {
        public Object call() throws Exception {
            return jettyConvention.getStopPort();
        }
    });
    jettyTask.getConventionMapping().map("stopKey", new Callable<Object>() {
        public Object call() throws Exception {
            return jettyConvention.getStopKey();
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:JettyPlugin.java


示例2: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Override
public void apply(Project project) {

    jSassBasePlugin = project.getPlugins().apply(JSassBasePlugin.class);
    project.getPlugins().apply(WarPlugin.class);

    SassCompile compileWebappSass = project.getTasks().create("compileWebappSass", SassCompile.class);
    compileWebappSass.setGroup(BasePlugin.BUILD_GROUP);
    compileWebappSass.setDescription("Compile sass and scss files for the webapp");

    WarPluginConvention warPluginConvention = project.getConvention().getPlugin(WarPluginConvention.class);
    compileWebappSass.setSourceDir(warPluginConvention.getWebAppDir());

    project.afterEvaluate(p -> {
        War war = (War) p.getTasks().getByName(WarPlugin.WAR_TASK_NAME);
        if (jSassBasePlugin.getExtension().isInplace()) {
            compileWebappSass.setDestinationDir(warPluginConvention.getWebAppDir());
        } else {
            compileWebappSass.setDestinationDir(new File(p.getBuildDir(), "generated/webappCss"));
            war.from(compileWebappSass.getDestinationDir());
        }
        war.dependsOn(compileWebappSass);
    });
}
 
开发者ID:freefair,项目名称:jsass-gradle-plugin,代码行数:25,代码来源:JSassWarPlugin.java


示例3: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Override
public void apply(Project project) {
    this.project = project;
    project.getPluginManager().apply(WarPlugin.class);

    project.getTasks().withType(War.class, warTask -> {

        NamedDomainObjectContainer<WarOverlay> warOverlays = project.container(WarOverlay.class, name -> new WarOverlay(name, warTask));
        warTask.getExtensions().add("overlays", warOverlays);

        project.afterEvaluate(p -> warOverlays.all(overlay -> {

            if (overlay.isEnabled()) {
                configureOverlay(overlay);
            } else {
                Collection<CopySpecInternal> children = (Collection<CopySpecInternal>) overlay.getWarTask().getRootSpec().getChildren();
                children.remove(overlay.getWarCopySpec());
            }

        }));
    });

}
 
开发者ID:freefair,项目名称:gradle-plugins,代码行数:24,代码来源:WarOverlayPlugin.java


示例4: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Override
public void apply(Project project) {
    project.getPlugins().apply(WarPlugin.class);

    WarAttachClassesConvention attachClassesConvention = new WarAttachClassesConvention();

    War war = (War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);
    war.getConvention().getPlugins().put("attachClasses", attachClassesConvention);

    project.afterEvaluate(p -> {
        if (attachClassesConvention.isAttachClasses()) {
            Jar jar = (Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME);
            jar.setClassifier(attachClassesConvention.getClassesClassifier());

            project.getArtifacts().add(Dependency.ARCHIVES_CONFIGURATION, jar);
        }
    });
}
 
开发者ID:freefair,项目名称:gradle-plugins,代码行数:19,代码来源:WarAttachClassesPlugin.java


示例5: setUpTestProject

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
private Project setUpTestProject(String buildFileName) throws IOException {
  Path buildFile = testProjectDir.getRoot().toPath().resolve("build.gradle");
  InputStream buildFileContent =
      getClass()
          .getClassLoader()
          .getResourceAsStream(
              "projects/AppEnginePluginTest/Extension/" + buildFileName + ".gradle");
  Files.copy(buildFileContent, buildFile);

  Path webInf = testProjectDir.getRoot().toPath().resolve("src/main/webapp/WEB-INF");
  Files.createDirectories(webInf);
  File appengineWebXml = Files.createFile(webInf.resolve("appengine-web.xml")).toFile();
  Files.write(appengineWebXml.toPath(), "<appengine-web-app/>".getBytes(Charsets.UTF_8));

  Project p = ProjectBuilder.builder().withProjectDir(testProjectDir.getRoot()).build();
  p.getPluginManager().apply(JavaPlugin.class);
  p.getPluginManager().apply(WarPlugin.class);
  p.getPluginManager().apply(AppEngineStandardPlugin.class);
  ((ProjectInternal) p).evaluate();

  return p;
}
 
开发者ID:GoogleCloudPlatform,项目名称:app-gradle-plugin,代码行数:23,代码来源:AppEngineStandardExtensionTest.java


示例6: testDefaultConfiguration

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Test
public void testDefaultConfiguration() throws IOException {
  File appengineWebXml =
      new File(testProjectDir.getRoot(), "src/main/webapp/WEB-INF/appengine-web.xml");
  appengineWebXml.getParentFile().mkdirs();
  appengineWebXml.createNewFile();
  Files.write(appengineWebXml.toPath(), "<web-app/>".getBytes());

  Project project = ProjectBuilder.builder().withProjectDir(testProjectDir.getRoot()).build();
  project.getPluginManager().apply(JavaPlugin.class);
  project.getPluginManager().apply(WarPlugin.class);
  project.getPluginManager().apply(AppEngineStandardPlugin.class);
  project.getPluginManager().apply(SourceContextPlugin.class);
  ((ProjectInternal) project).evaluate();

  ExtensionAware ext =
      (ExtensionAware) project.getExtensions().getByName(AppEngineCorePlugin.APPENGINE_EXTENSION);
  GenRepoInfoFileExtension genRepoInfoExt =
      new ExtensionUtil(ext).get(SourceContextPlugin.SOURCE_CONTEXT_EXTENSION);
  Assert.assertEquals(
      new File(project.getBuildDir(), "sourceContext"), genRepoInfoExt.getOutputDirectory());
}
 
开发者ID:GoogleCloudPlatform,项目名称:app-gradle-plugin,代码行数:23,代码来源:SourceContextPluginTest.java


示例7: getArchiveTask

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
/**
 * Returns the most suitable Archive-Task for wrapping in the swarm jar - in the following order:
 *
 * 1. Custom-JAR-Task defined in SwarmExtension 'archiveTask'
 * 2. WAR-Task
 * 3. JAR-Task
 */
private Jar getArchiveTask(Project project) {

    TaskCollection<Jar> existingArchiveTasks = project.getTasks().withType(Jar.class);
    Jar customArchiveTask = project.getExtensions().getByType(SwarmExtension.class).getArchiveTask();

    if (customArchiveTask != null) {
        return existingArchiveTasks.getByName(customArchiveTask.getName());

    } else if (existingArchiveTasks.findByName(WarPlugin.WAR_TASK_NAME) != null) {
        return existingArchiveTasks.getByName(WarPlugin.WAR_TASK_NAME);

    } else if (existingArchiveTasks.findByName(JavaPlugin.JAR_TASK_NAME) != null) {
        return existingArchiveTasks.getByName(JavaPlugin.JAR_TASK_NAME);
    }

    return null;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:25,代码来源:PackagePlugin.java


示例8: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Override
public void apply(final Project project) {
	Logger logger = project.getLogger();
	logger.info("applying jsweet plugin");

	if (!project.getPlugins().hasPlugin(JavaPlugin.class) && !project.getPlugins().hasPlugin(WarPlugin.class)) {
		logger.error("No java or war plugin detected. Enable java or war plugin.");
		throw new IllegalStateException("No java or war plugin detected. Enable java or war plugin.");
	}

	JSweetPluginExtension extension = project.getExtensions().create("jsweet", JSweetPluginExtension.class);

	JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
	SourceSetContainer sourceSets = javaPluginConvention.getSourceSets();
	SourceSet mainSources = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);

	JSweetTranspileTask task = project.getTasks().create("jsweet", JSweetTranspileTask.class);
	task.setGroup("generate");
	task.dependsOn(JavaPlugin.COMPILE_JAVA_TASK_NAME);
	task.setConfiguration(extension);
	task.setSources(mainSources.getAllJava());
	task.setClasspath(mainSources.getCompileClasspath());
	
	JSweetCleanTask cleanTask = project.getTasks().create("jsweetClean", JSweetCleanTask.class);
	cleanTask.setConfiguration(extension);
}
 
开发者ID:lgrignon,项目名称:jsweet-gradle-plugin,代码行数:27,代码来源:JSweetPlugin.java


示例9: configure

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
public void configure(Project project, JettyOption jettyOption, File jettyConf) {
	ConfigurationContainer configs = project.getConfigurations();

	Configuration runtimeConf = configs.getByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME);
	Configuration jettyClassPath = configs.getByName(PwtLibPlugin.CONF_JETTY);

	configureJavaArgs(jettyOption);

	addClassPath(jettyClassPath.getAsPath());
	addClassPath(runtimeConf.getAsPath());

	if (jettyOption.getLogRequestFile() != null) {
		ResourceUtils.ensureDir(jettyOption.getLogRequestFile().getParentFile());
		addArg("--log", jettyOption.getLogRequestFile());
	}
	if (jettyOption.getLogFile() != null) {
		ResourceUtils.ensureDir(jettyOption.getLogFile().getParentFile());
		addArg("--out", jettyOption.getLogFile());
	}
	addArg("--host", jettyOption.getBindAddress());
	addArg("--port", jettyOption.getPort());
	addArg("--stop-port", jettyOption.getStopPort());
	addArg("--stop-key", jettyOption.getStopKey());

	addArg(jettyConf.getAbsolutePath());
}
 
开发者ID:Putnami,项目名称:putnami-gradle-plugin,代码行数:27,代码来源:JettyServerBuilder.java


示例10: configureProvidedConfigurations

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
/**
 * Setup the the 'providedCompile' and 'providedRuntime' configurations, just like War.
 * TODO See if we can recursively get all the dependent projects and apply it to them too.
 * But it would have to be a future action.
 */
public static void configureProvidedConfigurations(final Project project) {
  ConfigurationContainer configurationContainer = project.getConfigurations();
  Configuration provideCompileConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME);
  if (provideCompileConfiguration==null) {
    provideCompileConfiguration = configurationContainer.create(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME)
                                  .setVisible(false)
                                  .setDescription("Additional compile classpath for libraries that should not be part of the archive.");
    configurationContainer.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME).extendsFrom(provideCompileConfiguration);
  }
  Configuration provideRuntimeConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME);
  if (provideRuntimeConfiguration==null) {
    provideRuntimeConfiguration = configurationContainer.create(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME)
                                  .setVisible(false)
                                  .extendsFrom(provideCompileConfiguration)
                                  .setDescription("Additional runtime classpath for libraries that should not be part of the archive.");
    configurationContainer.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME).extendsFrom(provideRuntimeConfiguration);
  }
}
 
开发者ID:r-murphy,项目名称:nw-gradle,代码行数:24,代码来源:DependenciesUtil.java


示例11: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
public void apply(Project project) {
    DeprecationLogger.nagUserOfPluginReplacedWithExternalOne("Jetty", "Gretty (https://github.com/akhikhl/gretty)");
    project.getPluginManager().apply(WarPlugin.class);
    JettyPluginConvention jettyConvention = new JettyPluginConvention();
    Convention convention = project.getConvention();
    convention.getPlugins().put("jetty", jettyConvention);

    configureMappingRules(project, jettyConvention);
    configureJettyRun(project);
    configureJettyRunWar(project);
    configureJettyStop(project, jettyConvention);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:JettyPlugin.java


示例12: configureJettyStop

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
private void configureJettyStop(Project project, final JettyPluginConvention jettyConvention) {
    JettyStop jettyStop = project.getTasks().create(JETTY_STOP, JettyStop.class);
    jettyStop.setDescription("Stops Jetty.");
    jettyStop.setGroup(WarPlugin.WEB_APP_GROUP);
    jettyStop.getConventionMapping().map("stopPort", new Callable<Object>() {
        public Object call() throws Exception {
            return jettyConvention.getStopPort();
        }
    });
    jettyStop.getConventionMapping().map("stopKey", new Callable<Object>() {
        public Object call() throws Exception {
            return jettyConvention.getStopKey();
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:JettyPlugin.java


示例13: WtpClasspathAttributeSupport

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
public WtpClasspathAttributeSupport(Project project, EclipseModel model) {
    isUtilityProject = !project.getPlugins().hasPlugin(WarPlugin.class) && !project.getPlugins().hasPlugin(EarPlugin.class);
    EclipseWtp eclipseWtp = model.getWtp();
    EclipseWtpComponent wtpComponent = eclipseWtp.getComponent();
    libDirName = wtpComponent.getLibDeployPath();
    Set<Configuration> rootConfigs = wtpComponent.getRootConfigurations();
    Set<Configuration> libConfigs = wtpComponent.getLibConfigurations();
    Set<Configuration> minusConfigs = wtpComponent.getMinusConfigurations();
    rootConfigFiles = collectFilesFromConfigs(rootConfigs, minusConfigs);
    libConfigFiles = collectFilesFromConfigs(libConfigs, minusConfigs);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:WtpClasspathAttributeSupport.java


示例14: testArchiveClassesProperty

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Test
public void testArchiveClassesProperty() {
    project.getPlugins().apply(WarPlugin.class);
    project.getPlugins().apply(WarArchiveClassesPlugin.class);

    War warTask = (War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);

    assertThat(warTask.hasProperty("archiveClasses")).isTrue();
    assertThat(warTask.property("archiveClasses")).isInstanceOf(Boolean.class);
}
 
开发者ID:freefair,项目名称:gradle-plugins,代码行数:11,代码来源:WarArchiveClassesPluginTest.java


示例15: testProperties

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Test
public void testProperties() {
    project.getPlugins().apply(WarPlugin.class);
    project.getPlugins().apply(WarAttachClassesPlugin.class);

    War warTask = (War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);

    assertThat(warTask.hasProperty("attachClasses")).isTrue();
    assertThat(warTask.property("attachClasses")).isInstanceOf(Boolean.class);

    assertThat(warTask.hasProperty("classesClassifier")).isTrue();
    assertThat(warTask.property("classesClassifier")).isInstanceOf(String.class);
}
 
开发者ID:freefair,项目名称:gradle-plugins,代码行数:14,代码来源:WarAttachClassesPluginTest.java


示例16: testProperties

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Test
public void testProperties() {
    Project project = ProjectBuilder.builder().build();

    project.getPlugins().apply(WarPlugin.class);
    project.getPlugins().apply(WarOverlayPlugin.class);

    Task warTask = project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);

    assertThat(warTask.hasProperty("overlays")).isTrue();
    assertThat(warTask.property("overlays")).isInstanceOf(DomainObjectCollection.class);
}
 
开发者ID:freefair,项目名称:gradle-plugins,代码行数:13,代码来源:WarOverlayPluginTest.java


示例17: initialize

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
/**
 * @see me.seeber.gradle.plugin.AbstractProjectConfigPlugin#initialize()
 */
@Override
public void initialize() {
    try {
        // HACK to avoid NullPointerException during resource loading
        URLConnection dummyConnection = new URLConnection(new URL("file:///")) {
            @Override
            public void connect() throws IOException {
                throw new IOException();
            }
        };

        dummyConnection.setDefaultUseCaches(false);
    }
    catch (IOException e) {
        Throwables.throwIfUnchecked(e);
        throw new RuntimeException(e);
    }

    getProject().getPlugins().apply(ProjectConfigPlugin.class);
    getProject().getPlugins().apply(EclipsePlugin.class);

    getProject().getPlugins().withType(WarPlugin.class, war -> {
        getProject().getPlugins().apply(EclipseWtpPlugin.class);
    });

    getProject().getPlugins().withType(JavaPlugin.class, java -> {
        getProject().getConfigurations().create(ECLIPSE_ANNOTATIONS_CONFIGURATION, c -> {
            c.setDescription("Classpath used when generating Eclipse external annotations from JAR files");
            c.setVisible(false);
            c.setTransitive(true);
            c.extendsFrom(
                    getProject().getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME));

            c.getDependencies().add(getProject().getDependencies().create("com.google.code.findbugs:jsr305:3.0.1"));
        });
    });
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:41,代码来源:EclipseConfigPlugin.java


示例18: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
@Override
public void apply(final Project project) {
	LOGGER.debug("apply pwt plugin");
	project.getPlugins().apply(PwtLibPlugin.class);
	project.getPlugins().apply(WarPlugin.class);

	// createSetUpTask(project);
	createCheckTask(project);
	createCompileTask(project);
	createCodeServerTask(project);
	createDevTask(project);
	createRunTask(project);
	createStopTask(project);
}
 
开发者ID:Putnami,项目名称:putnami-gradle-plugin,代码行数:15,代码来源:PwtPlugin.java


示例19: apply

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
public void apply(Project project) {
    project.getPlugins().apply(WarPlugin.class);
    JettyPluginConvention jettyConvention = new JettyPluginConvention();
    Convention convention = project.getConvention();
    convention.getPlugins().put("jetty", jettyConvention);

    configureMappingRules(project, jettyConvention);
    configureJettyRun(project);
    configureJettyRunWar(project);
    configureJettyStop(project, jettyConvention);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:JettyPlugin.java


示例20: getWebXml

import org.gradle.api.plugins.WarPlugin; //导入依赖的package包/类
private Object getWebXml(Project project) {
    War war = (War) project.getTasks().getByName(WarPlugin.WAR_TASK_NAME);
    File webXml;
    if (war.getWebXml() != null) {
        webXml = war.getWebXml();
    } else {
        webXml = new File(getWarConvention(project).getWebAppDir(), "WEB-INF/web.xml");
    }
    return webXml;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:JettyPlugin.java



注:本文中的org.gradle.api.plugins.WarPlugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThaiBuddhistChronology类代码示例发布时间:2022-05-22
下一篇:
Java CommandHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap