本文整理汇总了Java中org.jetbrains.idea.maven.model.MavenId类的典型用法代码示例。如果您正苦于以下问题:Java MavenId类的具体用法?Java MavenId怎么用?Java MavenId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenId类属于org.jetbrains.idea.maven.model包,在下文中一共展示了MavenId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testCreatingBlank
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void testCreatingBlank() throws Exception {
if (!hasMavenInstallation()) return;
MavenId id = new MavenId("org.foo", "module", "1.0");
createNewModule(id);
List<MavenProject> projects = MavenProjectsManager.getInstance(myProject).getProjects();
assertEquals(1, projects.size());
MavenProject project = projects.get(0);
assertEquals(id, project.getMavenId());
assertModules("module");
MavenProjectsManager.getInstance(myProject).isMavenizedModule(getModule("module"));
assertSame(project, MavenProjectsManager.getInstance(myProject).findProject(getModule("module")));
assertNotNull(myProjectRoot.findFileByRelativePath("src/main/java"));
assertNotNull(myProjectRoot.findFileByRelativePath("src/test/java"));
assertSources("module", "src/main/java");
assertTestSources("module", "src/test/java");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MavenModuleBuilderTest.java
示例2: _testUnresolvedSystemArtifacts
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void _testUnresolvedSystemArtifacts() throws Exception {
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
"<dependencies>" +
" <dependency>" +
" <groupId>fff</groupId>" +
" <artifactId>zzz</artifactId>" +
" <version>666</version>" +
" <scope>system</scope>" +
" <systemPath>" + myProjectRoot.getPath() + "/foo.jar</systemPath>" +
" </dependency>" +
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result =
myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MavenServerEmbedderTest.java
示例3: createLog4JTest
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
private VirtualFile createLog4JTest(final Project project, final MavenId projectId, final VirtualFile appDirectory)
{
return new WriteCommandAction<VirtualFile>(project, "Create Log4J Test File", PsiFile.EMPTY_ARRAY)
{
@Override
protected void run(@NotNull Result<VirtualFile> result) throws Throwable
{
try
{
VirtualFile configFile = appDirectory.findOrCreateChildData(this, "log4j2-test.xml");
final FileTemplateManager manager = FileTemplateManager.getInstance(project);
final FileTemplate template = manager.getInternalTemplate(MuleFileTemplateDescriptorManager.LOG4J2_TEST);
final Properties defaultProperties = manager.getDefaultProperties();
final String text = template.getText(defaultProperties);
VfsUtil.saveText(configFile, text);
result.setResult(configFile);
}
catch (IOException e)
{
showError(project, e);
}
}
}.execute().getResultObject();
}
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:26,代码来源:MuleMavenProjectBuilderHelper.java
示例4: setupRootModel
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
super.setupRootModel(rootModel);
addListener(new ModuleBuilderListener() {
@Override
public void moduleCreated(@NotNull Module module) {
setMuleFramework(module);
}
});
setMuleFacet(rootModel.getModule());
final Project project = rootModel.getProject();
final VirtualFile root = createAndGetContentEntry();
rootModel.addContentEntry(root);
//Check if this is a module and has parent
final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null);
MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> {
new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId);
});
}
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:25,代码来源:MuleMavenModuleBuilder.java
示例5: testAddingManagedProjectIfNoArrgerator
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void testAddingManagedProjectIfNoArrgerator() throws Exception {
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
assertEquals(1, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
setModuleNameAndRoot("module", getProjectPath() + "/module");
setAggregatorProject(null);
createNewModule(new MavenId("org.foo", "module", "1.0"));
myProjectRoot.findFileByRelativePath("module/pom.xml");
assertEquals(2, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenModuleBuilderTest.java
示例6: resolve
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
public void resolve(RepositoryMetadata metadata, RepositoryRequest request) throws RepositoryMetadataResolutionException {
super.resolve(metadata, request);
MavenWorkspaceMap map = myWorkspaceMap;
if (map == null) return;
Metadata data = metadata.getMetadata();
Versioning versioning = data.getVersioning();
if (versioning == null) {
data.setVersioning(versioning = new Versioning());
}
for (MavenId each : map.getAvailableIds()) {
if (each.equals(data.getGroupId(), data.getArtifactId())) {
versioning.addVersion(each.getVersion());
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:CustomMaven3RepositoryMetadataManager.java
示例7: addArtifact
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
public MavenId addArtifact(int indexId, File artifactFile) throws RemoteException, MavenServerIndexerException {
try {
IndexingContext index = getIndex(indexId);
ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile);
if (artifactContext == null) return null;
addArtifact(myIndexer, index, artifactContext);
org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo();
return new MavenId(a.groupId, a.artifactId, a.version);
}
catch (Exception e) {
throw new MavenServerIndexerException(wrapException(e));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:Maven3ServerIndexerImpl.java
示例8: findVersions
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
public List<String> findVersions(Artifact artifact) {
List<String> res = new ArrayList<String>();
for (MavenId id : myWorkspaceMap.getAvailableIds()) {
if (equals(id.getArtifactId(), artifact.getArtifactId()) && equals(id.getGroupId(), artifact.getGroupId())) {
String version = id.getVersion();
if (version != null) {
res.add(version);
}
}
}
return res;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:Maven30WorkspaceReader.java
示例9: _testUnresolvedSystemArtifactsWithoutPath
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void _testUnresolvedSystemArtifactsWithoutPath() throws Exception {
if (ignore()) return; // need to repair model before resolving
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
"<dependencies>" +
" <dependency>" +
" <groupId>fff</groupId>" +
" <artifactId>zzz</artifactId>" +
" <version>666</version>" +
" <scope>system</scope>" +
" </dependency>" +
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenServerExecutionResult result =
myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList(), Collections.<String>emptyList());
assertNotNull(result);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MavenServerEmbedderTest.java
示例10: addArtifact
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public synchronized void addArtifact(final File artifactFile) {
doIndexTask(new IndexTask<Object>() {
public Object doTask() throws Exception {
MavenId id = myData.addArtifact(artifactFile);
String groupId = id.getGroupId();
String artifactId = id.getArtifactId();
String version = id.getVersion();
myData.hasGroupCache.put(groupId, true);
String groupWithArtifact = groupId + ":" + artifactId;
myData.hasArtifactCache.put(groupWithArtifact, true);
myData.hasVersionCache.put(groupWithArtifact + ':' + version, true);
addToCache(myData.groupToArtifactMap, groupId, artifactId);
addToCache(myData.groupWithArtifactToVersionMap, groupWithArtifact, version);
myData.flush();
return null;
}
}, null);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MavenIndex.java
示例11: getResult
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@NotNull
public List<MavenId> getResult() {
List<MavenId> result = new ArrayList<MavenId>();
for (TreePath each : myResultList.getSelectionPaths()) {
Object sel = each.getLastPathComponent();
MavenArtifactInfo info;
if (sel instanceof MavenArtifactInfo) {
info = (MavenArtifactInfo)sel;
}
else {
info = ((MavenArtifactSearchResult)sel).versions.get(0);
}
result.add(new MavenId(info.getGroupId(), info.getArtifactId(), info.getVersion()));
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenArtifactSearchPanel.java
示例12: testDoNotAddManagedProjectIfAddingAsModuleToAggregator
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void testDoNotAddManagedProjectIfAddingAsModuleToAggregator() throws Exception {
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
assertEquals(1, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
setModuleNameAndRoot("module", getProjectPath() + "/module");
setAggregatorProject(myProjectPom);
createNewModule(new MavenId("org.foo", "module", "1.0"));
myProjectRoot.findFileByRelativePath("module/pom.xml");
assertEquals(1, myProjectsManager.getProjectsTreeForTests().getManagedFilesPaths().size());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenModuleBuilderTest.java
示例13: searchForArtifact
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@NotNull
public static List<MavenId> searchForArtifact(Project project, Collection<MavenDomDependency> managedDependencies) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
assert ourResultForTest != null;
List<MavenId> res = ourResultForTest;
ourResultForTest = null;
return res;
}
MavenArtifactSearchDialog d = new MavenArtifactSearchDialog(project, "", false);
d.setManagedDependencies(managedDependencies);
if (!d.showAndGet()) {
return Collections.emptyList();
}
return d.getResult();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenArtifactSearchDialog.java
示例14: testReturningNotFoundArtifacts
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void testReturningNotFoundArtifacts() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
"<dependencies>" +
" <dependency>" +
" <groupId>lib</groupId>" +
" <artifactId>xxx</artifactId>" +
" <version>1</version>" +
" </dependency>" +
" <dependency>" +
" <groupId>junit</groupId>" +
" <artifactId>junit</artifactId>" +
" <version>4.0</version>" +
" </dependency>" +
"</dependencies>");
MavenProject project = myProjectsTree.getRootProjects().get(0);
MavenArtifactDownloader.DownloadResult unresolvedArtifacts = downloadArtifacts(Arrays.asList(project), null);
assertUnorderedElementsAreEqual(unresolvedArtifacts.resolvedSources, new MavenId("junit", "junit", "4.0"));
assertUnorderedElementsAreEqual(unresolvedArtifacts.resolvedDocs, new MavenId("junit", "junit", "4.0"));
assertUnorderedElementsAreEqual(unresolvedArtifacts.unresolvedSources, new MavenId("lib", "xxx", "1"));
assertUnorderedElementsAreEqual(unresolvedArtifacts.unresolvedDocs, new MavenId("lib", "xxx", "1"));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ArtifactsDownloadingTest.java
示例15: describe
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public static MavenId describe(PsiFile psiFile) {
MavenDomProjectModel model = getMavenDomModel(psiFile, MavenDomProjectModel.class);
String groupId = model.getGroupId().getStringValue();
String artifactId = model.getArtifactId().getStringValue();
String version = model.getVersion().getStringValue();
if (groupId == null) {
groupId = model.getMavenParent().getGroupId().getStringValue();
}
if (version == null) {
version = model.getMavenParent().getVersion().getStringValue();
}
return new MavenId(groupId, artifactId, version);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenDomUtil.java
示例16: applyFix
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor d) {
try {
VirtualFile modulePom = createModulePom();
MavenId id = MavenDomUtil.describe(myPsiFile);
String groupId = id.getGroupId() == null ? "groupId" : id.getGroupId();
String artifactId = modulePom.getParent().getName();
String version = id.getVersion() == null ? "version" : id.getVersion();
MavenUtil.runOrApplyMavenProjectFileTemplate(project,
modulePom,
new MavenId(groupId, artifactId, version),
myWithParent ? id : null,
myPsiFile.getVirtualFile(),
true);
}
catch (IOException e) {
MavenUtil.showError(project, "Cannot create a module", e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenModulePsiReference.java
示例17: doIsValid
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
protected boolean doIsValid(MavenId id, MavenProjectIndicesManager manager, ConvertContext context) {
if (StringUtil.isEmpty(id.getGroupId())) return false;
if (manager.hasGroupId(id.getGroupId())) return true;
// Check if artifact was found on importing.
MavenProject mavenProject = findMavenProject(context);
if (mavenProject != null) {
for (MavenArtifact artifact : mavenProject.findDependencies(id.getGroupId(), id.getArtifactId())) {
if (artifact.isResolved()) {
return true;
}
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenArtifactCoordinatesGroupIdConverter.java
示例18: MavenModuleBuilderHelper
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
public MavenModuleBuilderHelper(@NotNull MavenId projectId,
MavenProject aggregatorProject,
MavenProject parentProject,
boolean inheritGroupId,
boolean inheritVersion,
MavenArchetype archetype,
Map<String, String> propertiesToCreateByArtifact,
String commaneName) {
myProjectId = projectId;
myAggregatorProject = aggregatorProject;
myParentProject = parentProject;
myInheritGroupId = inheritGroupId;
myInheritVersion = inheritVersion;
myArchetype = archetype;
myPropertiesToCreateByArtifact = propertiesToCreateByArtifact;
myCommandName = commaneName;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenModuleBuilderHelper.java
示例19: collectProfiles
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
private void collectProfiles(MavenProgressIndicator process) {
process.setText(ProjectBundle.message("maven.searching.profiles"));
Set<String> availableProfiles = new LinkedHashSet<String>();
Set<String> activatedProfiles = new LinkedHashSet<String>();
MavenProjectReader reader = new MavenProjectReader();
MavenGeneralSettings generalSettings = getGeneralSettings();
MavenProjectReaderProjectLocator locator = new MavenProjectReaderProjectLocator() {
public VirtualFile findProjectFile(MavenId coordinates) {
return null;
}
};
for (VirtualFile f : getParameters().myFiles) {
MavenProject project = new MavenProject(f);
process.setText2(ProjectBundle.message("maven.reading.pom", f.getPath()));
project.read(generalSettings, MavenExplicitProfiles.NONE, reader, locator);
availableProfiles.addAll(project.getProfilesIds());
activatedProfiles.addAll(project.getActivatedProfilesIds().getEnabledProfiles());
}
getParameters().myProfiles = new ArrayList<String>(availableProfiles);
getParameters().myActivatedProfiles = new ArrayList<String>(activatedProfiles);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MavenProjectBuilder.java
示例20: updateStep
import org.jetbrains.idea.maven.model.MavenId; //导入依赖的package包/类
@Override
public void updateStep() {
MavenArchetype archetype = myBuilder.getArchetype();
Map<String, String> props = new LinkedHashMap<String, String>();
MavenId projectId = myBuilder.getProjectId();
props.put("groupId", projectId.getGroupId());
props.put("artifactId", projectId.getArtifactId());
props.put("version", projectId.getVersion());
props.put("archetypeGroupId", archetype.groupId);
props.put("archetypeArtifactId", archetype.artifactId);
props.put("archetypeVersion", archetype.version);
if (archetype.repository != null) props.put("archetypeRepository", archetype.repository);
myMavenPropertiesPanel.setDataFromMap(props);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SelectPropertiesStep.java
注:本文中的org.jetbrains.idea.maven.model.MavenId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论