English 中文(简体)
• 如何在Netbeans使用Static Weaving Ant 任务与Eclipse-Link JPA?
原标题:How to apply Static Weaving Ant Task with Eclipse-Link JPA in Netbeans?

我正在使用Netbeans 7.1.1和玻璃鱼3.1.2服务器。 作为JPA提供商,我决定使用与Netbeans一道装运的ec光线2.3.0。 页: 1 我愿利用幻觉,我的项目由大约45个协会实体班组成,他们之间有许多关系,我决定使用Staving。 此外,“Entity”课程属于单独的“Lib”类项目,而“EJB”项目的持久性是xml。

我已经遵循以下指示:http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving>http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving

我把ant子放在了建材中(低于)。 使用Netbeans时是否正确? The snippet from Building-impl.xml:

<target name="-post-jar" description="New task definition for EclipseLink static weaving">
    <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>
</target>
<target name="weaving" description="perform weaving" depends="-post-jar">
    <weave  source="${dist.jar}MyProject.jar"
            target="${dist.jar}MyProject_Weaved.jar"
            persistenceinfo="${dist.jar}....MyProjectEEMyProject-ejbuildclassesMETA-INFpersistence.xml"
            loglevel="FINER">
        <classpath>
            <pathelement path="${dist.jar}libeclipselink-2.3.0.jar"/>
            <pathelement path="${dist.jar}libjavaee-api-6.0.jar"/>
            <pathelement path="${dist.jar}libjasypt-1.9.0.jar"/>
            <pathelement path="${dist.jar}libjavax.persistence-2.0.jar"/>
            <pathelement path="${dist.jar}liborg.eclipse.persistence.jpa.jpql_1.0.0.jar"/>
            <pathelement path="${dist.jar}libjoda-time-2.1.jar"/>
            <pathelement path="${dist.jar}libjms.jar"/>
        </classpath>
    </weave>
</target>

道路上的所有jar也都作为图书馆列入Netbeans IDE。 在打上“Clean & Building”时,我现在发现以下错误:

D:workspaceMyProject
bprojectuild-impl.xml:703: taskdef class org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask cannot be found
using the classloader AntClassLoader[]

我在这里错了吗?

最佳回答

你们需要加上link。 jar and javax.persistence.jar to the Ant categorypath.

Netbeans到工具/备选方案/杂项/工具上去,并在那里打上班子。

问题回答

我还利用Netbeans 8.0.1在TomEE 1.7.0使用Eclipselink 2.4.2开发java ee项目,我刚刚将以下项目列入我的build.xml。 (我从未修改过建筑设计,因为Netbeans在组合中修改内容时可以超出建筑设计:

<target name="--weaving-def" description="New task definition for EclipseLink static weaving" depends="dist">
    <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"
             classpath="${j2ee.platform.classpath}">
    </taskdef>
</target>
<target name="weaving" description="perform weaving" depends="--weaving-def">
    <weave source="${build.classes.dir}"
           target="${build.classes.dir}"
           loglevel="INFO">
        <classpath path="${j2ee.platform.classpath}:${javac.classpath}"/>  
    </weave>
</target>

您可看到<>。 我在所有Netbeans Java EE中仅使用了常用的变量。 辅助项目。 我没有直接界定项目已经界定的变量。

在我执行过程中,我使用了爆炸的目录结构,我坚持不懈。

${build.classes.dir}/META-INF/persistence.xml

www.un.org/spanish/ecosoc 最重要的事情是正确界定“

现在

ant weaving 

定点挖掘工作将完成。 大约需要15秒才能建设,因此,我只能依靠测试服务器和生产服务器,而不是在我的发展环境中建设这种方式。

如果我只是简单的操作(或使用Netbeans建造菜单)

ant dist

如果没有挖掘,大楼就会正常。

当然,我有着一个充满活力的定义。

<persistence-unit name="MY-PU" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>mydata</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="eclipselink.logging.logger" value="org.eclipse.persistence.logging.DefaultSessionLog"/>
        <property name="eclipselink.logging.level" value="INFO"/>
        <property name="eclipselink.weaving" value="static"/>
    </properties>
</persistence-unit>

我还必须包括:org.eclipse.persistence.jpa.jpql_1.0.1.jarorg.eclipse.persistence.jpa.modelgen.processor-2.3.2.jar/strong>,以便使我们得以生存。 希望这一帮助。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...