org.glassfish.javaeetutorial的不可解析的父POM:dukes-tutoring

时间:2016-02-14 19:55:19

标签: java maven netbeans glassfish java-ee-7

我想在netbeans.for中设置公爵辅导项目,因为我有以下

configurations-jdk8,netbeans 8.0.2,glassfish 4.1,apache-maven-3.3.3

我没有在我的glassfish目录中进行公爵辅导项目tut-install / examples / case-studies所以我下载了java_ee_sdk-7u2.zip并在解压后我复制了公爵辅导项目并在netbeans中导入该项目file-> open project->

但是当我去构建并运行项目时,我遇到了以下错误

[ERROR] Some problems were encountered while processing the POMs:
Non-resolvable parent POM for org.glassfish.javaeetutorial:dukes-tutoring:[unknown-version]: Failure to find org.glassfish.javaeetutorial:case-studies:pom:7.0.5 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 13
 @ 
The build could not read 1 project -> [Help 1]

  The project org.glassfish.javaeetutorial:dukes-tutoring:[unknown-version] (/home/yogesh/Downloads/dukes-tutoring/pom.xml) has 1 error
    Non-resolvable parent POM for org.glassfish.javaeetutorial:dukes-tutoring:[unknown-version]: Failure to find org.glassfish.javaeetutorial:case-studies:pom:7.0.5 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 13 -> [Help 2]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

我的pom结构

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>case-studies</artifactId>
        <groupId>org.glassfish.javaeetutorial</groupId>
        <version>7.0.5</version>
    </parent>
    <groupId>org.glassfish.javaeetutorial</groupId>
    <artifactId>dukes-tutoring</artifactId>
    <packaging>pom</packaging>
    <name>dukes-tutoring</name>
    <modules>
        <module>dukes-tutoring-common</module>
    </modules>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <skip>true</skip>
                    <executable>${glassfish.home}/bin/asadmin${glassfish.executables.suffix}</executable>
                </configuration>
            </plugin>    
        </plugins>      
    </build>
</project>

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,我可以给你一些提示,也许会有所帮助。

首先,您需要项目默认位于它所在的文件夹中,否则您需要对POM文件进行许多更改,因为很多配置都被引用到父POM文件中,例如glassfish主文件夹和版本以及许多其他事情。喜欢这一行:

<executable>${glassfish.home}/bin/asadmin${glassfish.executables.suffix}</executable>

其次,按照提到的那样打开项目(因为项目在2个模块中有依赖项)“打开项目对话框,导航到:tut-install / examples / case-studies选择dukes-tutoring文件夹。选中Open Required Projects复选框,然后单击Open Project。“...

第三,用依赖项构建项目(dukes-tutoring)。如果您使用的是netbeans,则可以右键单击该项目,然后单击“使用依赖项构建”

四,构建成功运行glassfish服务器并使用mvn install部署项目(dukes-tutoring)。

答案 1 :(得分:0)

您还需要提取父项目。

在文件夹glassfish4\docs\javaee-tutorial中的 java_ee_sdk-7u2.zip 内,您必须在某处提取完整的示例文件夹。然后打开此文件夹中的 dukes-tutoring 项目。

有关详细信息,请参阅The Java EE Tutorial - Running the Duke's Tutoring Case Study Application