使用数据库设置应用程序 - tapestry-hibernate 失败

set up an application with a database - tapestry-hibernate fail

我正在尝试为我的网络应用程序设置 pom.xml 以连接数据库。当我将 <artifactId>tapestry-core</artifactId> 更改为 <artifactId>tapestry-hibernate</artifactId>.

时出现问题

这是我尝试构建时的输出:

The POM for org.apache.tapestry:tapestry-hibernate:jar:5.4-beta-24 is missing, no dependency information available
The POM for unknown.binary:hibernate-jpa-2.1-api-1.0.0.Final:jar:SNAPSHOT is missing, no dependency information available
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.177s
Finished at: Mon Mar 30 20:18:00 CEST 2015
Final Memory: 6M/15M
------------------------------------------------------------------------
Failed to execute goal on project TapestryApp: Could not resolve dependencies for project com.rile:TapestryApp:war:1.0-SNAPSHOT: Failure to find org.apache.tapestry:tapestry-hibernate:jar:5.4-beta-24 in https://repository.apache.org/content/groups/staging/ was cached in the local repository, resolution will not be reattempted until the update interval of apache-staging has elapsed or updates are forced -> [Help 1]

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/DependencyResolutionException

我使用的是最新版本的 NetBeans IDE。

这里是完整的 pom.xml 文件:

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.rile</groupId>
    <artifactId>TapestryApp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>TapestryApp</name>
    <dependencies>
        <!-- To set up an application with a database, change the artifactId below to
        tapestry-hibernate, and add a dependency on your JDBC driver. You'll also
        need to add Hibernate configuration files, such as hibernate.cfg.xml. -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-hibernate</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>

        <!-- Include the Log4j implementation for the SLF4J logging framework -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j-release-version}</version>
        </dependency>
        <!--
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-hibernate</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>
        -->
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.2</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.34</version>
        </dependency>

        <!-- Uncomment this to add support resource minification and runtime compilation -->
        <!--
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-yuicompressor</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>
        -->

        <!-- Uncomment this to add support for file uploads: -->
        <!--
         <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-upload</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>
        -->

        <!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests)
        will fail, preventing Maven from packaging the WAR. Tapestry includes a large number
        of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng-release-version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>${easymock-release-version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-test</artifactId>
            <version>${tapestry-release-version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Provided by the servlet container, but sometimes referenced in the application
        code. -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${servlet-api-release-version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Provide dependency to the Tapestry javadoc taglet which replaces the Maven component report -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-javadoc</artifactId>
            <version>${tapestry-release-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <dependency>
            <groupId>unknown.binary</groupId>
            <artifactId>hibernate-jpa-2.1-api-1.0.0.Final</artifactId>
            <version>SNAPSHOT</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>TapestryApp</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <optimize>true</optimize>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7.2</version>
                <configuration>
                    <systemPropertyVariables>
                        <tapestry.execution-mode>Qa</tapestry.execution-mode>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.16</version>
                <configuration>
                    <!-- Log to the console. -->
                    <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
                        <!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug
                        that prevents the requestLog from being set. -->
                        <append>true</append>
                    </requestLog>
                    <systemProperties>
                        <systemProperty>
                            <name>tapestry.execution-mode</name>
                            <value>development</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting/>

    <repositories>

        <!-- This repository is only needed when the Tapestry version is a preview release, rather
        than a final release. -->
        <repository>
            <id>apache-staging</id>
            <url>https://repository.apache.org/content/groups/staging/</url>
        </repository>
        <repository>
            <id>unknown-jars-temp-repo</id>
            <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
            <url>file:${project.basedir}/lib</url>
        </repository>
    </repositories>

    <properties>
        <tapestry-release-version>5.4-beta-24</tapestry-release-version>
        <servlet-api-release-version>2.5</servlet-api-release-version>
        <testng-release-version>6.5.2</testng-release-version>
        <easymock-release-version>3.0</easymock-release-version>
        <slf4j-release-version>1.7.7</slf4j-release-version>

    </properties>
</project>

此版本的 tapestry-hibernate 在 maven central repository neither in Apache staging repository 中不可用(您在 POM 文件中引用它)。

如果您想使用测试版,那么我建议您使用最新的可用版本(例如 this one)。

编辑:

在你的 POM 文件的末尾你有一个 属性:

<tapestry-release-version>5.4-beta-24</tapestry-release-version>

改为:

<tapestry-release-version>5.4-beta-28</tapestry-release-version>

编辑2:

顺便说一句,您定义了两次以下依赖项:

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-hibernate</artifactId>
    <version>${tapestry-release-version}</version>
</dependency>

目前没有什么坏处,但你最好清理一下。