HyperJaxb3 项目发生了什么?

问题描述 投票:0回答:2

我知道 Hyperjaxb3 库对我的项目非常有用,阅读了多个站点的一些描述,并决定将其嵌入到我的 Spring-Hibernate 项目中。

我在 https://jaxb.java.net/ 中找到了对 Hyperjaxb3 的引用,它看起来非常官方,但超链接 - http://confluence.highsource.org/display/HJ3/Home - 没有打不开。

我找到了一些旧的 POM 示例,将其包含到我的项目中,并找到了一些旧版本引用,试图消除它们,但现在看来我遇到了对旧 Hibernate 版本的依赖,错误是像这样:

java.util.ServiceConfigurationError:com.sun.tools.xjc.Plugin:Provider org.jvnet.hyperjaxb3.hibernate.plugin.HibernatePlugin无法实例化:java.lang.NoClassDefFoundError:org/hibernate/type/MutableType

我想知道是否有更好的 Maven 入口,该项目是否还存在,以及如何将它与现代 Hibernate 一起使用。

这是我关于 Hyperjaxb3 的 pom 摘录,其中我排除了一些过时的链接并指定了其他依赖项的最新版本:

    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb-version}</version>
    </dependency>        
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>${jaxb-version}</version>
    </dependency>  
    <!--<dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3</artifactId>
        <version>0.6.1</version>
    </dependency>        -->
    <dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3-hibernate-plugin</artifactId>
        <version>0.1</version>
        <exclusions>
            <exclusion>
                <groupId>hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
            </exclusion>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon-dom</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-xjc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>  
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-attrs</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>3.2.1</version>
    </dependency>

    <dependency>
        <groupId>commons-beanutils</groupId>   
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.2</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>   
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>   
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>

我当前并没有尝试生成带注释的 Hibernate 实体类,而是来自 PurchaseOdrer 示例的 POJO。这就是我目前所做的:

public void initializeModel(String name, InputStream src, String dir) throws IOException, URISyntaxException{
    dir = Paths.get(new URL(dir).toURI()).toString();
    File directory = new File(dir);
    directory.mkdirs();

    SchemaCompiler sc = XJC.createSchemaCompiler();
    sc.setDefaultPackageName(this.getClass().getPackage().getName() + ".generated");

    InputSource is = new InputSource(src);
    is.setSystemId(name);

    sc.parseSchema(is);
    S2JJAXBModel model = sc.bind();
    JCodeModel codeModel = model.generateCode(null, null);

    CodeWriter cw = new FileCodeWriter(directory);        
    codeModel.build(cw);
}
jaxb hyperjaxb
2个回答
5
投票

免责声明:我是Hyperjaxb3的作者。

该项目托管在 GitHub 上:

最新版本0.6.1可以正常工作,可以正常工作。

不过,我已经不再积极开发了。

它可以与当前版本的 hibernate 一起使用吗?

版本 0.6.1 已使用 Hibernate 4.1.7 进行测试。 HJ3 只是一个代码生成器,它生成标准 JPA 注释的类。因此,它很有可能适用于最新版本的 Hibernate。

我无法从 Maven 获取 0.6.1 jar。看起来它已经从 Maven 存储库中删除了。

真的吗?还在那里。

http://repo1.maven.org/maven2/org/jvnet/hyperjaxb3/hyperjaxb3-ejb-plugin/0.6.1/

我不明白我是否需要 2011 年的“hyperjaxb3-hibernate-plugin”0.1。

你绝对不知道。

或者你知道任何分叉或类似物吗?

不幸的是,没有什么能接近。


0
投票

那么 hyperjaxb3 在 0.6.1 版本中被阻止了?我去了这个 git 仓库 并阅读“此存储库已与 maven-jaxb2-plugin 一起合并到 jaxb-tools 存储库中。” 。然后转到 this 重定向 gir 存储库 ,但这里读到 Hyperjaxb3 只是处于“预览”状态,没有其他对 Maven 插件的引用来使用比 0.6.1 更新的版本。 另外,在maven搜索网站上只有一个插件版本 0.6.2 jaxb-tools 是否为 4.0.0 或更高版本。

0.6.2 是 Hyperjaxb3 的较新版本吗?

© www.soinside.com 2019 - 2024. All rights reserved.