Java 无法在maven上取消xml格式

Java 无法在maven上取消xml格式,java,xml,maven,Java,Xml,Maven,我有junit测试,它将我的xml解组到对象,很好,它可以工作 但当我运行maven命令mvn surefire report:report-Pmytests时,它无法将xml反汇编到对象。 毫无例外,我有空对象 我的pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.

我有junit测试,它将我的xml解组到对象,很好,它可以工作

但当我运行maven命令
mvn surefire report:report-Pmytests
时,它无法将xml反汇编到对象。 毫无例外,我有空对象

我的pom.xml

<?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>

    <groupId>com.project</groupId>
    <artifactId>automation</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>


    <build>
        <directory>target</directory>
        <sourceDirectory>src/main/java</sourceDirectory>
        <outputDirectory>target/classes</outputDirectory>
        <finalName>AUTOMATION-01</finalName>
        <testSourceDirectory>src/test/java/com/tests</testSourceDirectory>
        <testOutputDirectory>target/test-classes</testOutputDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>


        <plugins>

            <plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <updateReleaseInfo>true</updateReleaseInfo>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>target</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

        </plugins>
    </build>


    <profiles>

        <profile>
            <id>myTests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.15</version>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <argLine>-Dfile.encoding=UTF-8</argLine>
                            <groups>com.testgroups.myTestGroup</groups>
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        </profiles>

    <dependencies>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.12</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/ojdbc6.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.perf4j</groupId>
            <artifactId>perf4j</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/perf4j-0.9.16.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>org.gelfj</groupId>
            <artifactId>gelfj</artifactId>
            <version>1.0.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/gelfj-1.0.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.1</version>
        </dependency>
    </dependencies>

</project>

4.0.0
com.project
自动化
罐子
1.0-快照
目标
src/main/java
目标/类别
自动化-01
src/test/java/com/tests
目标/测试类
src/main/resources
真的
org.apache.maven.plugins
maven源插件
附加来源
罐子
org.apache.maven.plugins
maven编译器插件
3.3
1.7
1.7
UTF-8
真的
org.apache.maven.plugins
maven部署插件
真的
maven清洁插件
3.0.0
目标
我的测试
org.apache.maven.plugins
maven surefire插件
2.15
UTF-8
-文件编码=UTF-8
com.testgroups.myTestGroup
真的
javax.xml.ws
JAXWSAPI
2.2.11
公地io
公地io
2.4
公地郎
公地郎
2.6
log4j
log4j
1.2.17
com.sun.xml.bind
jaxb impl
2.2.11
org.glassfish.jaxb
jaxb运行时
2.2.11
javax.xml.bind
jaxb api
2.2.12
朱尼特
朱尼特
4.12
com.oracle
ojdbc6
11.2.0.3
系统
${project.basedir}/lib/ojdbc6.jar
org.perf4j
perf4j
1
系统
${project.basedir}/lib/perf4j-0.9.16.jar
org.gelfj
gelfj
1.0.1
系统
${project.basedir}/lib/gelfj-1.0.1.jar
com.googlecode.json-simple
简单json
1.1.1
org.apache.httpcomponents
httpclient
4.5.1

你能帮我解决这个问题吗

Maven区分了资源和测试资源。也许您正在将正在编组的xml文件放在
src/main/resources
文件夹下面的某个地方


如果是这种情况,请尝试将xml文件复制到
src/test/resources

您已经打开了
标记,但没有相应的
标记。这是问题中的复制粘贴错误吗?是的,这只是我的复制粘贴错误。但问题是不同的