使用Flex Mojo的原型创建的新项目抛出无法查找父项目 - Maven异常

时间:2010-06-15 17:25:11

标签: java flex maven-2 flexmojos flex-mojos

这可能是一个愚蠢的问题,但我似乎无法弄明白。我对flex和maven完全不熟悉。

Maven 2.2.1:Maven 2.2.1解压缩,M2_HOME设置和存储库被更改为指向settings.xml

中的不同驱动器位置

Flex 4.0:已安装

使用flexmojo创建了一个多模块化的webapp项目:

mvn archetype:generate
-DarchetypeRepository=http://repository.sonatype.org/content/groups/flexgroup 
-DarchetypeGroupId=org.sonatype.flexmojos 
-DarchetypeArtifactId=flexmojos-archetypes-modular-webapp 
-DarchetypeVersion=RELEASE

以下选项

groupId=com.test
artifactId=test
version=1.0-snapshot
package=com.tests

*创建*

test
|-- pom.xml
|--swc -pom.xml
|--swf -pom.xml
`--war -pom.xml

父pom将swc,swf,war作为模块。

依赖是war-> swf-> swc。

使用swf,swc的父artifactId,war分别设置为swf,swc,test。

在测试文件夹上执行mvn(对于干净或任何事情)我得到以下错误。

G:\Projects\test>mvn -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/test/swc/1.0-snapshot/swc-1.0-snapshot.pom
[INFO] Unable to find resource 'com.test:swc:pom:1.0-snapshot' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: com.test
ArtifactId: swc
Version: 1.0-snapshot

Reason: Unable to download the artifact from any repository

  com.test:swc:pom:1.0-snapshot

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot find parent: com.test:swc for project: com.test:swc-swc:swc:1.0-snapshot for project com.test:swc-swc:swc:1.0-snapshot
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: Cannot find parent: com.test:swc for project: com.test:swc-swc:swc:1.0-snapshot for project com.test:swc-swc:swc:1.0-snapshot
        at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1396)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:823)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
        at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:560)
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
        ... 12 more
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'com.test:swc' not found in repository: Unable to download the artifact from any repository

  com.test:swc:pom:1.0-snapshot

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)

 for project com.test:swc
        at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
        at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1392)
        ... 19 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository

  com.test:swc:pom:1.0-snapshot

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)


        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
        at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
        ... 20 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
        at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
        ... 22 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Jun 15 19:22:15 GMT+02:00 2010
[INFO] Final Memory: 1M/2M
[INFO] ------------------------------------------------------------------------

看起来它试图从maven的中央存储库下载项目而不是构建它。

我错过了什么?

2 个答案:

答案 0 :(得分:0)

没有所有的POM,有点难以看清。

但是他的父母关系不应该遵循依赖关系。

所有war,swf和swc应该具有相同的父级,即测试目录中的pom.xml。

答案 1 :(得分:0)

如果从根目录运行mvn install会发生什么:

G:\Projects\test>mvn install