本文整理汇总了Java中org.apache.maven.shared.invoker.InvocationRequest.setUserSettingsFile方法的典型用法代码示例。如果您正苦于以下问题:Java InvocationRequest.setUserSettingsFile方法的具体用法?Java InvocationRequest.setUserSettingsFile怎么用?Java InvocationRequest.setUserSettingsFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.shared.invoker.InvocationRequest
的用法示例。
在下文中一共展示了InvocationRequest.setUserSettingsFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeLicenseProject
import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private void executeLicenseProject(File pomFile, File repoDir) throws Exception {
InvocationRequest mavenRequest = new DefaultInvocationRequest();
mavenRequest.setPomFile(pomFile);
mavenRequest.setBaseDirectory(pomFile.getParentFile());
mavenRequest.setUserSettingsFile(userSettings);
mavenRequest.setLocalRepositoryDirectory(repoDir);
mavenRequest.setGoals(Arrays.asList("clean", "package"));
Invoker invoker = new DefaultInvoker();
try {
InvocationResult result = invoker.execute(mavenRequest);
if (result.getExitCode() != 0) {
throw result.getExecutionException() != null ? result.getExecutionException()
: new IllegalStateException("Build failure: " + result.getExitCode());
}
getLog().info("Licenses POM executed: " + pomFile.getAbsolutePath());
} catch (Exception e) {
getLog().error("Error when executing " + pomFile.getAbsolutePath(), e);
}
}
示例2: mvnCleanPackageWithProperties
import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public void mvnCleanPackageWithProperties(
final String path, final Properties properties, final File customSettingsFile) {
final InvocationRequest request = new DefaultInvocationRequest();
request.setProperties(properties);
if (customSettingsFile != null && FileUtils.sizeOf(customSettingsFile) > 0) {
request.setUserSettingsFile(customSettingsFile);
}
final List<String> mavenGoals = new ArrayList<>();
mavenGoals.add("clean");
mavenGoals.add("package");
request.setGoals(mavenGoals);
logToHandler(request.getGoals(), properties);
logToFile(request.getGoals(), properties);
invoke(request, path);
}
示例3: setupInvocationRequest
import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private InvocationRequest setupInvocationRequest() throws MojoExecutionException {
InvocationRequest request = new DefaultInvocationRequest();
request.setPomFile(this.project.getFile());
// installation and deployment are performed in a later step. We first need to ensure that there are no changes in
// the scm, ...
request.setGoals(this.goals);
request.setProperties(this.releaseArgs);
request.setProfiles(this.profiles);
request.setShellEnvironmentInherited(true);
for (String key : this.releaseEnvironmentVariables.keySet()) {
request.addShellEnvironment(key, this.releaseEnvironmentVariables.get(key));
}
request.setOffline(this.settings.isOffline());
request.setInteractive(this.settings.isInteractiveMode());
MavenExecutionRequest originalRequest = this.session.getRequest();
File globalSettingsFile = originalRequest.getGlobalSettingsFile();
if (globalSettingsFile != null && globalSettingsFile.exists() && globalSettingsFile.isFile()) {
request.setGlobalSettingsFile(globalSettingsFile);
}
File userSettingsFile = originalRequest.getUserSettingsFile();
if (userSettingsFile != null && userSettingsFile.exists() && userSettingsFile.isFile()) {
request.setUserSettingsFile(userSettingsFile);
}
File toolchainsFile = originalRequest.getUserToolchainsFile();
if (toolchainsFile.exists() && toolchainsFile.isFile()) {
request.setToolchainsFile(toolchainsFile);
}
return request;
}
示例4: 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;
}
示例5: executeGeneratedProjectBuild
import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
private void executeGeneratedProjectBuild(File pomFile, File projectDir, File repoDir) throws Exception {
InvocationRequest mavenRequest = new DefaultInvocationRequest();
mavenRequest.setPomFile(pomFile);
mavenRequest.setBaseDirectory(projectDir);
mavenRequest.setUserSettingsFile(userSettings);
mavenRequest.setLocalRepositoryDirectory(repoDir);
mavenRequest.setGoals(Collections.singletonList("install"));
Properties props = System.getProperties();
if (Boolean.parseBoolean(downloadSources)) {
props.setProperty("swarm.download.sources", "");
}
if (Boolean.parseBoolean(downloadPoms)) {
props.setProperty("swarm.download.poms", "");
}
mavenRequest.setProperties(props);
Invoker invoker = new DefaultInvoker();
InvocationResult result = invoker.execute(mavenRequest);
if (result.getExitCode() != 0) {
throw result.getExecutionException();
}
getLog().info("Built project from BOM: " + projectDir.getAbsolutePath());
}
示例6: archetypeGenerate
import org.apache.maven.shared.invoker.InvocationRequest; //导入方法依赖的package包/类
public void archetypeGenerate(
final String archetypeVersion,
final String groupId,
final String artifactId,
final String secretKey,
final String anonymousKey,
final String jwsKey,
final String adminPassword,
final String installPath,
final File customSettingsFile) {
final InvocationRequest request = new DefaultInvocationRequest();
request.setGoals(Collections.singletonList(
archetypeVersion.contains("SNAPSHOT")
? "org.apache.maven.plugins:maven-archetype-plugin:2.4:generate"
: "archetype:generate"));
request.setBatchMode(true);
final Properties properties =
archetypeProperties(archetypeVersion, groupId, artifactId, secretKey,
anonymousKey, jwsKey, adminPassword);
request.setProperties(properties);
if (customSettingsFile != null && FileUtils.sizeOf(customSettingsFile) > 0) {
request.setUserSettingsFile(customSettingsFile);
}
logToHandler(request.getGoals(), properties);
logToFile(request.getGoals(), properties);
invoke(request, installPath);
}
示例7: 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;
}