Erro ao compilar Jaxb no Maven

5 respostas
Norxs

Estou tento um problema com o maven quando compilo um projeto que utiliza jaxb.

Quando eu digito "mvn clean install" acontece o seguinte erro (alguém tem alguma luz?):

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Norxs JDBC Driver Manager
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [antrun:run {execution: Generate XBean}]
[INFO] Executing tasks
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An Ant BuildException has occured: com.thoughtworks.qdox.parser.ParseException: syntax error @[81,29] in file:/C:/tools/tools-driverManager/src/main/java/com/norxs/tools/driverManager/model/Driver.java

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Fri Aug 07 09:46:47 BRT 2009
[INFO] Final Memory: 8M/15M
[INFO] ------------------------------------------------------------------------

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2009.08.03 at 11:33:43 AM BRT 
//

package com.norxs.tools.driverManager.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element ref="{}Name"/>
 *         &lt;element ref="{}URLFormat"/>
 *         &lt;element ref="{}DefaultClass"/>
 *         &lt;element ref="{}WebSite"/>
 *         &lt;element ref="{}ClassConfigured"/>
 *         &lt;element ref="{}Dialect"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "name",
    "urlFormat",
    "defaultClass",
    "webSite",
    "classConfigured",
    "dialect"
})
@XmlRootElement(name = "Driver")
public class Driver {

    @XmlElement(name = "Name", required = true)
    protected String name;
    @XmlElement(name = "URLFormat", required = true)
    protected String urlFormat;
    @XmlElement(name = "DefaultClass", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NCName")
    protected String defaultClass;
    @XmlElement(name = "WebSite", required = true)
    @XmlSchemaType(name = "anyURI")
    protected String webSite;
    
    @XmlElement(name = "ClassConfigured")
    protected String classConfigured;
    
    @XmlElement(name = "Dialect")
    protected String dialect;

    /**
     * Gets the value of the name property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the urlFormat property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getURLFormat() {
        return urlFormat;
    }

    /**
     * Sets the value of the urlFormat property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setURLFormat(String value) {
        this.urlFormat = value;
    }

    /**
     * Gets the value of the defaultClass property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getDefaultClass() {
        return defaultClass;
    }

    /**
     * Sets the value of the defaultClass property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setDefaultClass(String value) {
        this.defaultClass = value;
    }

    /**
     * Gets the value of the webSite property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getWebSite() {
        return webSite;
    }

    /**
     * Sets the value of the webSite property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setWebSite(String value) {
        this.webSite = value;
    }

    /**
     * Gets the value of the classConfigured property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getClassConfigured() {
        return classConfigured;
    }

    /**
     * Sets the value of the classConfigured property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setClassConfigured(String value) {
        this.classConfigured = value;
    }
    
    /**
     * Gets the value of the dialect property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getDialect() {
        return dialect;
    }

    /**
     * Sets the value of the dialect property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setDialect(String value) {
        this.dialect = value;
    }

}

5 Respostas

Don

acho que o erro esta sendo causado pelas annotations…
qual a versão do jdk?

Norxs

java version "1.6.0_14"
Java™ SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot™ Client VM (build 14.0-b16, mixed mode, sharing)

Apache Maven 2.2.0 (r788681; 2009-06-26 10:04:01-0300)
Java version: 1.6.0_14
Java home: c:\jdk1.6.0_14\jre
Default locale: pt_BR, platform encoding: Cp1252
OS name: “windows xp” version: “5.1” arch: “x86” Family: “windows”

estou instalando a versão 1.6.0_15 pra testa … mas não estou com muita esperança :frowning:

Don

como esta o source e o target no pom?

Norxs

o pom agora está assim

<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/maven-v4_0_0.xsd">
	<parent>
		<artifactId>tools</artifactId>
		<groupId>com.norxs.tools</groupId>
		<version>${tools-version}</version>
		<relativePath>../pom.xml</relativePath>
	</parent>
	
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.norxs.tools</groupId>
	<artifactId>tools-driverManager</artifactId>
	<packaging>jar</packaging>
	<version>${tools-version}</version>
	<name>Norxs JDBC Driver Manager</name>
	
</project>

antes estava assim:

<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/maven-v4_0_0.xsd">
	<parent>
		<artifactId>tools</artifactId>
		<groupId>com.norxs.tools</groupId>
		<version>${tools-version}</version>
		<relativePath>../pom.xml</relativePath>
	</parent>
	
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.norxs.tools</groupId>
	<artifactId>tools-driverManager</artifactId>
	<packaging>jar</packaging>
	<version>${tools-version}</version>
	<name>Norxs JDBC Driver Manager</name>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>com.sun.xml.bind</groupId>
		    <artifactId>jaxb-impl</artifactId>
		    <version>2.1.6</version>
		</dependency>
	</dependencies>
	<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
	        <plugin>
	            <groupId>org.jvnet.jaxb2.maven2</groupId>
	            <artifactId>maven-jaxb2-plugin</artifactId>
	            <executions>
	                <execution>
	                    <goals>
	                        <goal>generate</goal>
	                    </goals>
						<configuration>
							<schemaIncludes>
								<value>**/Drivers.xsd</value>
							</schemaIncludes>
						</configuration>
	                </execution>
	            </executions>
	        </plugin>
        </plugins>
    </build>
</project>
Norxs

achei o erro … no pom pai eu executo o seguinte plugin:

<plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <configuration> <tasks> <taskdef classname="org.apache.xbean.spring.generator.MappingGeneratorTask" name="mapping"> <classpath> <pathelement path="${basedir}/target/classes"> </pathelement> <path refid="maven.test.classpath"></path> </classpath> </taskdef> <mapping destFile="${basedir}/target/arquivo.xsd" namespace="http://norxs.com.br/config/${tools-version}/${artifactId}" srcdir="${basedir}/src/main/java" metaInfDir="${basedir}/target/classes/" /> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </plugin>

só não entendi porque está dando o erro …

Criado 7 de agosto de 2009
Ultima resposta 7 de ago. de 2009
Respostas 5
Participantes 2