当前位置: 首页>>代码示例>>Java>>正文


Java InvocationRequest.setMavenOpts方法代码示例

本文整理汇总了Java中org.apache.maven.shared.invoker.InvocationRequest.setMavenOpts方法的典型用法代码示例。如果您正苦于以下问题:Java InvocationRequest.setMavenOpts方法的具体用法?Java InvocationRequest.setMavenOpts怎么用?Java InvocationRequest.setMavenOpts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.shared.invoker.InvocationRequest的用法示例。


在下文中一共展示了InvocationRequest.setMavenOpts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runMavenGoals

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
protected void runMavenGoals(File outputDir, String... goals) throws MavenInvocationException {
    List<String> goalList = Arrays.asList(goals);
    LOG.info("Invoking maven with goals: " + goalList + " in folder: " + outputDir);
    File pomFile = new File(outputDir, "pom.xml");

    InvocationRequest request = new DefaultInvocationRequest();
    request.setLocalRepositoryDirectory(localMavenRepo);
    request.setInteractive(false);
    request.setPomFile(pomFile);
    request.setGoals(goalList);

    // lets use a dummy service name to avoid it being too long
    request.setMavenOpts("-Dfabric8.service.name=dummy-name");

    Invoker invoker = new DefaultInvoker();
    InvocationResult result = invoker.execute(request);
    int exitCode = result.getExitCode();
    LOG.info("maven result " + exitCode + " exception: " + result.getExecutionException());
    if (exitCode != 0) {
        LOG.error("Failed to invoke maven goals: " + goalList + " in folder: " + outputDir + ". Exit Code: " + exitCode);
        failedFolders.add(outputDir);
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:24,代码来源:ProjectGenerator.java

示例2: okButtonActionPerformed

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
    String groupId = this.groupIdField.getText();
    String artifactId = this.artifactIdField.getText();
    String version = this.versionField.getText();
    String file = this.fileField.getText();
    
    InvocationRequest req = new DefaultInvocationRequest();
    req.setGoals( Collections.singletonList( "install:install-file" ) );
    req.setMavenOpts("-Dfile="+file+" -DgroupId="+groupId+" -DartifactId="+artifactId+" -Dversion="+version+" -Dpackaging=jar");
    Invoker invoker = new DefaultInvoker();
    try {
        invoker.execute( req );
        JOptionPane.showMessageDialog(null, "Library installed");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "Library could not be installed", "Install Error", JOptionPane.ERROR_MESSAGE);
    }
}
 
开发者ID:escv,项目名称:maven-install-ui,代码行数:18,代码来源:InstallLibraryDialog.java

示例3: createInvocationRequest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public InvocationRequest createInvocationRequest()
{
    InvocationRequest request = new DefaultInvocationRequest();

    request.setAlsoMake( alsoMake );
    request.setAlsoMakeDependents( alsoMakeDependents );
    request.setDebug( debug );
    request.setFailureBehavior( failureBehavior );
    request.setGlobalChecksumPolicy( globalChecksumPolicy );
    request.setGlobalSettingsFile( stringToFile( globalSettings ) );
    request.setGoals( goals );
    request.setInteractive( !batchMode );
    request.setJavaHome( stringToFile( javaHome ) );
    request.setLocalRepositoryDirectory( stringToFile( localRepository ) );
    request.setMavenOpts( mavenOpts );
    request.setOffline( offline );
    request.setPomFile( stringToFile( pomFile ) );
    request.setProfiles( profiles );
    request.setProjects( projects );
    request.setRecursive( !nonRecursive );
    request.setResumeFrom( resumeFrom );
    request.setShowErrors( showErrors );
    request.setShowVersion( showVersion );
    request.setThreads( threads );
    request.setToolchainsFile( stringToFile( toolchains ) );
    request.setUpdateSnapshots( updateSnapshots );
    request.setUserSettingsFile( stringToFile( userSettings ) );

    Properties properties = new Properties();
    defines.forEach( ( key, value ) -> properties.put( key, value ) );
    request.setProperties( properties );

    return request;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:35,代码来源:BisectCliRequest.java

示例4: invokeChildTest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private Pair<MavenInvokeResult, JavaConfig> invokeChildTest(
        String subDirName, String additionalProfile) throws IOException {
    // set up working directory
    clearWorkDir(subDirName);
    File workDir = mkWorkDir(subDirName).getAbsoluteFile();
    JavaConfig conf = new JavaConfig(workDir);
    conf.setTestDir(new File(workDir, "src/test/java"));
    conf.setRunTestOnly(true);
    YamlUtils.dump(conf.toYamlObject(), new File(workDir, "sahagin.yml"));
    FileUtils.copyFile(new File("pom.xml"), new File(workDir, "pom.xml"));
    FileUtils.copyDirectory(testResourceDir(subDirName + "/src"), new File(workDir, "src"));
    FileUtils.copyDirectory(testResourceDir("expected/captures"), new File(workDir, "captures"));

    // execute test
    InvocationRequest testRequest = new DefaultInvocationRequest();
    if (System.getProperty("sahagin.maven.java.home") != null) {
        testRequest.setJavaHome(new File(System.getProperty("sahagin.maven.java.home")));
    }
    testRequest.setGoals(Arrays.asList("clean", "test"));
    if (additionalProfile == null) {
        testRequest.setProfiles(Arrays.asList("sahagin-jar-test"));
    } else {
        testRequest.setProfiles(Arrays.asList("sahagin-jar-test", additionalProfile));
    }
    String jarPathOpt = "-Dsahagin.temp.jar="
            + new File("target/sahagin-temp.jar").getAbsolutePath();
    testRequest.setMavenOpts(jarPathOpt);
    testRequest.setBaseDirectory(workDir);
    MavenInvokeResult testResult = mavenInvoke(testRequest, subDirName + ":test");

    return Pair.of(testResult, conf);
}
 
开发者ID:SahaginOrg,项目名称:sahagin-java,代码行数:33,代码来源:HookMethodDefTest.java

示例5: createAndConfigureAnInvocationRequest

import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
protected InvocationRequest createAndConfigureAnInvocationRequest( ItemWithProperties currentValue )
    {
        InvocationRequest request = new DefaultInvocationRequest();

        request.setAlsoMake( isAlsoMake() );
        request.setAlsoMakeDependents( isAlsoMakeDependents() );
        request.setDebug( isDebug() );
        request.setFailureBehavior( getFailureBehaviour() );
        request.setGlobalChecksumPolicy( getGlobalChecksumPolicy() );
        request.setGlobalSettingsFile( getGlobalSettingsFile() );
        request.setInteractive( isInteractive() );

        request.setLocalRepositoryDirectory( getLocalRepositoryDirectory() );
        request.setMavenOpts( getMavenOpts() );
        request.setNonPluginUpdates( isNonPluginUpdates() );
        request.setOffline( isOffline() );

//        request.setProperties( properties )
//        ;
        // @TODO: Think about it.
        // request.setPomFile(pomFile);
        // @TODO: Think about it.
        // request.setPomFileName(pomFilename);

        // The following parameter do make sense to use a placeholder
        // base directory
        // cd @[email protected]
        // mvn clean package
        request.setBaseDirectory( getBaseDirectoryAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // goals:
        // mvn plugin-name:@[email protected]
        //
        request.setGoals( getGoalsAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // Profiles:
        // mvn [email protected]@ clean package
        // mvn [email protected]@
        request.setProfiles( getProfilesAfterPlaceHolderIsReplaced( currentValue.getName() ) );
        // Projects:
        // mvn -pl [email protected]@ clean package
        request.setProjects( getProjectsAfterPlaceHolderIsReplaced( currentValue.getName() ) );

        Properties props = getMergedProperties(currentValue );
        request.setProperties( props );

        request.setRecursive( isRecursive() );
        request.setResumeFrom( getResumeFrom() );
        request.setShellEnvironmentInherited( isShellEnvironmentInherited() );
        request.setShowErrors( isShowErrors() );
        request.setShowVersion( isShowVersion() );
        request.setThreads( getThreads() );
        request.setToolchainsFile( getToolchains() );
        request.setUpdateSnapshots( isUpdateSnapshots() );
        request.setUserSettingsFile( getUserSettings() );
        
        return request;
    }
 
开发者ID:khmarbaise,项目名称:iterator-maven-plugin,代码行数:57,代码来源:AbstractInvokerMojo.java


注:本文中的org.apache.maven.shared.invoker.InvocationRequest.setMavenOpts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。