Maven项目不在父级中构建

时间:2019-06-17 11:01:58

标签: java maven xjc

当我从包含pom的文件夹中运行时,运行$mvn clean install可以工作,但是当我进入文件夹级别并运行相同的命令时,会出现以下错误:

[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building xsdtools 4.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xsdtools ---
[INFO] Deleting /home/myUser/Development/gitRepo/xxx_project/project/xsdtoolFolder/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.1:enforce (enforce-versions) @ xsdtools ---
[INFO] 
[INFO] --- jaxb2-maven-plugin:2.1:xjc (xjc) @ xsdtools ---
[INFO] Adding 'extension' flag to XJC arguments, since the 'generateEpisode' argument is given. (XJCs 'episode' argument requires that the 'extension' argument is provided).
[INFO] Ignored given or default xjbSources [/home/myUser/Development/gitRepo/xxx_project/project/xsdtoolFolder/src/main/xjb], since it is not an existent file or directory.
[ERROR] null [-1,-1] 
java.io.FileNotFoundException: /home/myUser/Development/gitRepo/xxx_project/project/src/main/xsd/MyProjectV3.xsd (No such file or directory)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:232)

pom文件具有以下内容:

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jaxb2-maven-plugin</artifactId>
      <version>2.1</version>

      <executions>
        <execution>
          <id>xjc</id>
          <goals>
            <goal>xjc</goal>
          </goals>
        </execution>
      </executions>

      <configuration>
        <!-- The package of your generated sources -->
        <sources>
          <source>src/main/xsd/MyProjectV3.xsd</source>
        </sources>
      </configuration>
    </plugin>
  </plugins>
</build>

我的文件结构是

xxx_project
  |
  -pom.xml
  -project
    |
    -pom.xml
    -src
      |
      -main
         |
         -xsd
           |
           -MyProjectV3.xsd

无论运行目录如何,如何使构建成功?

0 个答案:

没有答案