Maven - have XSD as a dependency

We have one project that defines the message formats that it creates with XSD files.

What is the easiest way to make these XSD files dependent on another project?

I was looking to use the maven-build-helper attach-artifact target to attach my XSD files.

Is there a better mechanism?

+3
source share
1 answer

I do not know the purpose of the attached artifact, but I did what you requested. I had wsdl and xsd files for writing Webservice artifacts and their client artifacts with 2 axis.

  • I put my wsdl and xsd in my own project called "wsdl" src / main / resources / META-INF and nothing else.
  • "" Java-SOAP-. wsdl wsdl xsd maven-dependency-plugin -. SOAP-.
  • , Webservice .

, . , :

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
      <execution>
        <id>unpack-wsdl-dependency</id>
        <phase>initialize</phase>
        <goals>
          <goal>unpack</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <artifactItems>
        <artifactItem>
          <groupId>${groupId}</groupId>
          <artifactId>wsdl</artifactId>
          <outputDirectory>target/wsdl</outputDirectory>
          <includes>META-INF/*.wsdl,META-INF/*.xsd</includes>
        </artifactItem>
      </artifactItems>
      <!-- other configurations here -->
    </configuration>
  </plugin>

, .

+3

Source: https://habr.com/ru/post/1779214/


All Articles