本文整理汇总了Java中org.jetbrains.idea.maven.importing.MavenRootModelAdapter类的典型用法代码示例。如果您正苦于以下问题:Java MavenRootModelAdapter类的具体用法?Java MavenRootModelAdapter怎么用?Java MavenRootModelAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenRootModelAdapter类属于org.jetbrains.idea.maven.importing包,在下文中一共展示了MavenRootModelAdapter类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: isMavenAarDependency
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public static boolean isMavenAarDependency(@NotNull Module module, @NotNull OrderEntry entry) {
if (ApplicationManager.getApplication().isUnitTestMode() && entry.getPresentableName().equals("maven_aar_dependency")) {
return true;
}
if (!(entry instanceof LibraryOrderEntry) || !isMavenizedModule(module)) {
return false;
}
final Library library = ((LibraryOrderEntry)entry).getLibrary();
if (library == null) {
return false;
}
final MavenProject mavenProject = MavenProjectsManager.getInstance(module.getProject()).findProject(module);
if (mavenProject == null) {
return false;
}
final MavenArtifact artifact = MavenRootModelAdapter.findArtifact(mavenProject, library);
return artifact != null && AAR_DEPENDENCY_AND_PACKAGING_TYPE.equals(artifact.getType());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidMavenUtil.java
示例2: reimportFacet
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
protected void reimportFacet(IdeModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter rootModel,
AppEngineFacet facet,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
MavenProjectChanges changes,
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
String version = getVersion(mavenProject);
if (version != null) {
String relativePath = "/com/google/appengine/appengine-java-sdk/" + version + "/appengine-java-sdk/appengine-java-sdk-" + version;
facet.getConfiguration().setSdkHomePath(FileUtil.toSystemIndependentName(mavenProject.getLocalRepository().getPath()) + relativePath);
AppEngineWebIntegration.getInstance().setupDevServer(facet.getSdk());
final String artifactName = module.getName() + ":war exploded";
final Artifact webArtifact = modelsProvider.getModifiableArtifactModel().findArtifact(artifactName);
AppEngineWebIntegration.getInstance().setupRunConfiguration(facet.getSdk(), webArtifact, module.getProject());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AppEngineFacetImporter.java
示例3: testDoesNotExcludeRegisteredSources
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public void testDoesNotExcludeRegisteredSources() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
new File(myProjectRoot.getPath(), "target/foo").mkdirs();
final File sourceDir = new File(myProjectRoot.getPath(), "target/src");
sourceDir.mkdirs();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom),
getModule("project"),
new IdeModifiableModelsProviderImpl(myProject));
adapter.addSourceFolder(sourceDir.getPath(), JavaSourceRootType.SOURCE);
adapter.getRootModel().commit();
}
});
updateProjectFolders();
assertSources("project", "target/src");
assertExcludes("project", "target/foo");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MavenFoldersImporterTest.java
示例4: testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public void testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom),
getModule("project"),
new IdeModifiableModelsProviderImpl(myProject));
adapter.useModuleOutput(new File(myProjectRoot.getPath(), "target/my-classes").getPath(),
new File(myProjectRoot.getPath(), "target/my-test-classes").getPath());
adapter.getRootModel().commit();
}
});
MavenFoldersImporter.updateProjectFolders(myProject, true);
ModuleRootManager rootManager = ModuleRootManager.getInstance(getModule("project"));
CompilerModuleExtension compiler = rootManager.getModuleExtension(CompilerModuleExtension.class);
assertTrue(compiler.getCompilerOutputUrl(), compiler.getCompilerOutputUrl().endsWith("my-classes"));
assertTrue(compiler.getCompilerOutputUrlForTests(), compiler.getCompilerOutputUrlForTests().endsWith("my-test-classes"));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenFoldersImporterTest.java
示例5: reimportFacet
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
protected void reimportFacet(
IdeModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter rootModel,
AppEngineStandardFacet facet,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
MavenProjectChanges changes,
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
String version = getVersion(mavenProject);
if (version != null) {
AppEngineStandardWebIntegration.getInstance().setupDevServer();
final String artifactName = module.getName() + ":war exploded";
final Artifact webArtifact =
modelsProvider.getModifiableArtifactModel().findArtifact(artifactName);
AppEngineStandardWebIntegration.getInstance()
.setupRunConfigurations(webArtifact, module, null /* existingConfiguration */);
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:22,代码来源:AppEngineFacetImporter.java
示例6: testDoesNotExcludeRegisteredSources
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public void testDoesNotExcludeRegisteredSources() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
new File(myProjectRoot.getPath(), "target/foo").mkdirs();
final File sourceDir = new File(myProjectRoot.getPath(), "target/src");
sourceDir.mkdirs();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom),
getModule("project"),
new MavenDefaultModifiableModelsProvider(myProject));
adapter.addSourceFolder(sourceDir.getPath(), false);
adapter.getRootModel().commit();
}
});
updateProjectFolders();
assertSources("project", "target/src");
assertExcludes("project", "target/foo");
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:MavenFoldersImporterTest.java
示例7: testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public void testDoNotUpdateOutputFoldersWhenUpdatingExcludedFolders() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom),
getModule("project"),
new MavenDefaultModifiableModelsProvider(myProject));
adapter.useModuleOutput(new File(myProjectRoot.getPath(), "target/my-classes").getPath(),
new File(myProjectRoot.getPath(), "target/my-test-classes").getPath());
adapter.getRootModel().commit();
}
});
MavenFoldersImporter.updateProjectFolders(myProject, true);
ModuleRootManager rootManager = ModuleRootManager.getInstance(getModule("project"));
CompilerModuleExtension compiler = rootManager.getModuleExtension(CompilerModuleExtension.class);
assertTrue(compiler.getCompilerOutputUrl(), compiler.getCompilerOutputUrl().endsWith("my-classes"));
assertTrue(compiler.getCompilerOutputUrlForTests(), compiler.getCompilerOutputUrlForTests().endsWith("my-test-classes"));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:MavenFoldersImporterTest.java
示例8: process
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
public void process(MavenModifiableModelsProvider mavenModifiableModelsProvider,
Module module,
MavenRootModelAdapter mavenRootModelAdapter,
MavenProjectsTree mavenProjectsTree,
MavenProject mavenProject,
MavenProjectChanges mavenProjectChanges,
Map<MavenProject, String> map,
List<MavenProjectsProcessorTask> list)
{
GoogleGuiceMutableModuleExtension extension = (GoogleGuiceMutableModuleExtension) enableModuleExtension(module, mavenModifiableModelsProvider, GoogleGuiceModuleExtension.class);
List<MavenArtifact> artifactList = mavenProject.findDependencies("com.google.inject", "guice");
for(MavenArtifact mavenArtifact : artifactList)
{
String version = mavenArtifact.getVersion();
if(VersionComparatorUtil.compare(version, "3.0") >= 0)
{
extension.setUseJSR330(true);
}
}
}
开发者ID:consulo,项目名称:consulo-google-guice,代码行数:23,代码来源:GoogleGuiceMavenImporter.java
示例9: process
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
public void process(IdeModifiableModelsProvider ideModifiableModelsProvider, Module module,
MavenRootModelAdapter mavenRootModelAdapter, MavenProjectsTree mavenProjectsTree,
MavenProject mavenProject, MavenProjectChanges mavenProjectChanges,
Map<MavenProject, String> map, List<MavenProjectsProcessorTask> processorTasks) {
String skip = this.findConfigValue(mavenProject, "skip");
if (!"true".equals(skip)) {
processorTasks.add(new MavenProcessorTask(module));
} else {
debug(() -> log.debug(
"Skipping index check for project " + module.getProject().getName() + " & module "
+ module.getName()));
}
}
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:15,代码来源:MavenImporter.java
示例10: importExternalAndroidLibDependencies
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
private static void importExternalAndroidLibDependencies(Project project,
MavenRootModelAdapter rootModelAdapter,
IdeModifiableModelsProvider modelsProvider,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
Map<MavenProject, String> mavenProject2ModuleName,
List<MavenProjectsProcessorTask> tasks) {
final ModifiableRootModel rootModel = rootModelAdapter.getRootModel();
removeUselessDependencies(rootModel, modelsProvider, mavenProject);
for (MavenArtifact depArtifact : mavenProject.getDependencies()) {
if (mavenTree.findProject(depArtifact) != null) {
continue;
}
final String type = depArtifact.getType();
if (AndroidMavenUtil.APKLIB_DEPENDENCY_AND_PACKAGING_TYPE.equals(type)) {
final AndroidExternalApklibDependenciesManager.MavenDependencyInfo depInfo =
AndroidExternalApklibDependenciesManager.MavenDependencyInfo.create(depArtifact);
final String apklibModuleName = doImportExternalApklibDependency(
project, modelsProvider, mavenTree, mavenProject,
mavenProject2ModuleName, tasks, depInfo);
if (ArrayUtil.find(rootModel.getDependencyModuleNames(), apklibModuleName) < 0) {
final DependencyScope scope = getApklibModuleDependencyScope(depArtifact);
if (scope != null) {
addModuleDependency(modelsProvider, rootModel, apklibModuleName, scope);
}
}
}
else if (AndroidMavenUtil.AAR_DEPENDENCY_AND_PACKAGING_TYPE.equals(type) &&
MavenConstants.SCOPE_COMPILE.equals(depArtifact.getScope())) {
importExternalAarDependency(depArtifact, mavenProject, mavenTree, rootModelAdapter, modelsProvider, project, tasks);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidFacetImporterBase.java
示例11: findArtifacts
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
private static Collection<MavenArtifact> findArtifacts(Collection<MavenProject> mavenProjects, List<LibraryOrderEntry> orderEntries) {
Collection<MavenArtifact> artifacts = new THashSet<MavenArtifact>();
for (MavenProject each : mavenProjects) {
for (LibraryOrderEntry entry : orderEntries) {
final MavenArtifact artifact = MavenRootModelAdapter.findArtifact(each, entry.getLibrary());
if (artifact != null && !"system".equals(artifact.getScope())) {
artifacts.add(artifact);
}
}
}
return artifacts;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:MavenAttachSourcesProvider.java
示例12: reimportFacet
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
protected void reimportFacet(MavenModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter rootModel,
XmlBeansFacet facet,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
MavenProjectChanges changes,
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
configureXmlBeansFacet(facet, mavenProject, module);
}
开发者ID:bsblabs,项目名称:intellij-xmlbeans-plugin,代码行数:13,代码来源:XmlBeansMavenImporter.java
示例13: process
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
public void process(IdeModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter mavenRootModelAdapter,
MavenProjectsTree mavenProjectsTree,
MavenProject mavenProject,
MavenProjectChanges mavenProjectChanges,
Map<MavenProject, String> mavenProjectStringMap,
List<MavenProjectsProcessorTask> mavenProjectsProcessorTasks) {
// Remove all entries with groupIds starting from com.jetbrains.intellij.
// They should be provided through IntelliJ SDK
ModifiableRootModel rootModel = mavenRootModelAdapter.getRootModel();
List<Library> libraries = new ArrayList<Library>();
for (OrderEntry entry : rootModel.getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
LibraryOrderEntry loe = (LibraryOrderEntry) entry;
String libraryName = loe.getLibraryName();
if (libraryName != null && libraryName.startsWith("Maven: " + IDEA_SDK_PREFIX)) {
rootModel.removeOrderEntry(entry);
libraries.add(loe.getLibrary());
}
}
}
updateManifestLocation(module, mavenProject);
// Workaround for Maven plugin bug which does not allow newly created unused libraries to be properly removed
// We schedule our own post-processing task that will clean out unused libraries
scheduleAnalyzeLibraryTask(mavenProjectsProcessorTasks, libraries);
}
开发者ID:Guidewire,项目名称:devkit-maven-support,代码行数:33,代码来源:PluginModuleImporter.java
示例14: process
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
public void process(IdeModifiableModelsProvider modifiableModelsProvider, Module module,
MavenRootModelAdapter rootModel, MavenProjectsTree mavenModel, MavenProject mavenProject,
MavenProjectChanges changes, Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
FacetManager facetManager = FacetManager.getInstance(module);
ModifiableFacetModel facetModel = modifiableModelsProvider.getModifiableFacetModel(module);
Set<String> targetTypes = new HashSet<>();
for (MavenPlugin mavenPlugin : mavenProject.getPlugins()) {
if (mavenPlugin.getGroupId().equals(myPluginGroupID)
&& mavenPlugin.getArtifactId().equals(myPluginArtifactID)) {
updateConfiguration(mavenPlugin, facetModel, facetManager, targetTypes);
}
}
}
开发者ID:konsoletyper,项目名称:teavm,代码行数:16,代码来源:TeaVMMavenImporter.java
示例15: process
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
public void process(
final MavenModifiableModelsProvider mavenModifiableModelsProvider,
Module module,
MavenRootModelAdapter mavenRootModelAdapter,
MavenProjectsTree mavenProjectsTree,
MavenProject mavenProject,
MavenProjectChanges mavenProjectChanges,
Map<MavenProject, String> mavenProjectStringMap,
List<MavenProjectsProcessorTask> mavenProjectsProcessorTasks)
{
enableModuleExtension(module, mavenModifiableModelsProvider, JavaWebModuleExtension.class);
ArtifactTemplate.NewArtifactConfiguration explodedArtifactConfiguration = ExplodedWarArtifactTemplate.doCreateArtifactTemplate(module,
mavenModifiableModelsProvider.getPackagingElementResolvingContext());
ModifiableArtifactModel artifactModel = mavenModifiableModelsProvider.getArtifactModel();
Artifact artifact = artifactModel.findArtifact(explodedArtifactConfiguration.getArtifactName());
if(artifact != null)
{
artifactModel.removeArtifact(artifact);
}
artifact = artifactModel.addArtifact(explodedArtifactConfiguration.getArtifactName(), explodedArtifactConfiguration.getArtifactType(),
explodedArtifactConfiguration.getRootElement());
ArtifactTemplate.NewArtifactConfiguration warArtifactConfiguration = WarArtifactTemplate.doCreateArtifactTemplate(artifact,
mavenModifiableModelsProvider.getPackagingElementResolvingContext());
Artifact warArtifact = artifactModel.findArtifact(warArtifactConfiguration.getArtifactName());
if(warArtifact != null)
{
artifactModel.removeArtifact(warArtifact);
}
artifactModel.addArtifact(warArtifactConfiguration.getArtifactName(), warArtifactConfiguration.getArtifactType(),
warArtifactConfiguration.getRootElement());
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:41,代码来源:WarMavenImporter.java
示例16: reimportFacet
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
@Override
protected void reimportFacet(IdeModifiableModelsProvider modelsProvider,
Module module,
MavenRootModelAdapter rootModel,
AndroidFacet facet,
MavenProjectsTree mavenTree,
MavenProject mavenProject,
MavenProjectChanges changes,
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
configurePaths(facet, mavenProject);
facet.getProperties().ENABLE_MANIFEST_MERGING = Boolean.parseBoolean(findConfigValue(mavenProject, "mergeManifests"));
facet.getProperties().COMPILE_CUSTOM_GENERATED_SOURCES = false;
configureAndroidPlatform(facet, mavenProject, modelsProvider);
final Project project = module.getProject();
importExternalAndroidLibDependencies(project, rootModel, modelsProvider, mavenTree, mavenProject, mavenProjectToModuleName,
postTasks);
if (hasAndroidLibDependencies(mavenProject) &&
MavenProjectsManager.getInstance(project).getImportingSettings().isUseMavenOutput()) {
// IDEA's apklibs building model is different from Maven's one, so we cannot use the same
rootModel.useModuleOutput(mavenProject.getBuildDirectory() + "/idea-classes",
mavenProject.getBuildDirectory() + "/idea-test-classes");
}
project.putUserData(DELETE_OBSOLETE_MODULE_TASK_KEY, Boolean.TRUE);
postTasks.add(new MyDeleteObsoleteApklibModulesTask(project));
// exclude folders where Maven generates sources if gen source roots were changed by user manually
final AndroidFacetConfiguration defaultConfig = new AndroidFacetConfiguration();
AndroidMavenProviderImpl.setPathsToDefault(mavenProject, module, defaultConfig);
if (!defaultConfig.getState().GEN_FOLDER_RELATIVE_PATH_APT.equals(
facet.getProperties().GEN_FOLDER_RELATIVE_PATH_APT)) {
final String rPath = mavenProject.getGeneratedSourcesDirectory(false) + "/r";
rootModel.unregisterAll(rPath, false, true);
rootModel.addExcludedFolder(rPath);
}
if (!defaultConfig.getState().GEN_FOLDER_RELATIVE_PATH_AIDL.equals(
facet.getProperties().GEN_FOLDER_RELATIVE_PATH_AIDL)) {
final String aidlPath = mavenProject.getGeneratedSourcesDirectory(false) + "/aidl";
rootModel.unregisterAll(aidlPath, false, true);
rootModel.addExcludedFolder(aidlPath);
}
if (facet.getProperties().LIBRARY_PROJECT) {
removeAttachedJarDependency(modelsProvider, mavenTree, mavenProject);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:AndroidFacetImporterBase.java
示例17: testForceReimport
import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; //导入依赖的package包/类
public void testForceReimport() throws Exception {
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
"<dependencies>" +
" <dependency>" +
" <groupId>junit</groupId>" +
" <artifactId>junit</artifactId>" +
" <version>4.0</version>" +
" </dependency>" +
"</dependencies>");
importProject();
assertModules("project");
createProjectSubDir("src/main/java");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ModifiableRootModel model = ModuleRootManager.getInstance(getModule("project")).getModifiableModel();
for (OrderEntry each : model.getOrderEntries()) {
if (each instanceof LibraryOrderEntry && MavenRootModelAdapter.isMavenLibrary(((LibraryOrderEntry)each).getLibrary())) {
model.removeOrderEntry(each);
}
}
model.commit();
}
});
assertSources("project");
assertModuleLibDeps("project");
myProjectsManager.forceUpdateAllProjectsOrFindAllAvailablePomFiles();
waitForReadingCompletion();
myProjectsManager.waitForResolvingCompletion();
myProjectsManager.performScheduledImportInTests();
assertSources("project", "src/main/java");
assertModuleLibDeps("project", "Maven: junit:junit:4.0");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:MavenProjectsManagerTest.java
注:本文中的org.jetbrains.idea.maven.importing.MavenRootModelAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论