Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7429885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:03:04+00:00 2026-05-29T09:03:04+00:00

Here is a small Example of what I would like to achieve: Maven Artifact

  • 0

Here is a small Example of what I would like to achieve:

Maven Artifact A is one of many Webservices and defines a XSD Schema with
definitions for Requests and Responses. (src/main/resources/xsd)

Artifact A depends on Artifact B wich is a simple JAR Project and contains a multitude
of Master XSDs with low level Type descriptions. (src/main/resources/xsd)

The XSDs in Artifact A use the type definitions (include) that are specified
once in Artifact B.

If at all possible I would really like to know how to include xsd files that are located in a jar which is loaded as as a maven dependency and how to resolve the webservice xsd (and wsdl) in IDEs like Netbeans and Eclipse.

If this approach seems to exotic – are there better practices for a clean design?

update

First here is a simple example of how I would expect the schema include to work….

Artifact A (WAR Module)
POM:
...
<artifactId>A</artifactId>
...
<dependency>
  <artifactId>B</artifactId>
  ...
</dependency>

Schema:
....
<xs:include schemaLocation="classpath://net/elfwyn/xsd/schema.xsd"/>
....

Artifact B (JAR Module)

Schema Location:
src/main/resources/net/elfwyn/xsd/schema.xsd

There seem to be several sollutions for a problem like this, but I do not know how to implement them in my environment:

I know of Catalog Resolvers embedded in the (netbeans7.1) IDE (for dev environemnt) and available as Maven Plugins (for productive environment), that should be able to specify an alias on the location of the schema file. This alias should then be used as the schema location.

However I do not know how to specify a Catalog.xml that accesses schemas inside a JAR File.
To me it seems to be the same problem as specifying it in the schema location directly.
Also there is the overhead of maintaining the catalog for each WAR – project wich I would rather not take if at all possible.

Concerning the Maven plugin I haven’t found out anything conclusive yet.

Other sources are implementing a custom catalog resolver in the context of jax-b,
but I cannot yet see a possible hook for implementing such a resolver in a Java-WS environment, and how it should work in conjunction with the maven-plugin mentioned above or the IDE Catalog resolver…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:03:06+00:00Added an answer on May 29, 2026 at 9:03 am

    I think your question is reasonable. In the past I have often found that I have a Maven module that needs to do special processing on files that can be found in dependent JARs.

    What I have done in the past is to make Artifact B a dependency of Artifact A. Then in the pom.xml of Artifact A I use a special configuration of the Maven dependency plugin as follows:

    <plugin>
        <!-- Used to pull XSD files from the JAR -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
              <execution>
                  <id>unpack-xsd-files</id>
                  <!-- Using the initialize phase because it is before the generate sources phase -->
                  <phase>initialize</phase>
                       <goals>
                           <goal>unpack</goal>
                       </goals>
                       <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <!-- Artifact that Holds our custom templates -->
                                    <groupId>com.mycorp</groupId>
                                    <artifactId>artifact-b</artifactId>
                                    <version>${artifact-b.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                             </artifactItems>
                             <includes>**/*.xsd</includes>
                             <outputDirectory>${project.basedir}/target/xsd-includes</outputDirectory>
                       </configuration>
                </execution>
        </executions>
    </plugin>
    

    Now your XSD files of interest can be found in the target directory of Artifact A and from there you can do anything you want with them. You can include them as resources, reference them from other XSD files, embed them in your own JARs or whatever! As you can see from the configuration, you also don’t have to put them in your target directory; you could put them directly into your /src/main/resources directory.

    You can add this configuration to any Maven module you want so that multiple modules can all work the same way. The nice thing about this approach is that it will also work from with Eclipse via M2Eclipse.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I could use strings, I would like to understand why this small example
Here is an example feed that I would like to parse: https://gdata.youtube.com/feeds/api/users/aniBOOM/subscriptions?v=2&alt=json You can
Here is small example: A <- c(1,1,1,1, 0, 0, 0, 2,2,2) B <- c(1,1,1,1,
Here's a small fiddle for my issue: http://jsfiddle.net/Yc9WY/52/ Essentially, one box of items is
I am writing a small Sinatra-based app and would like each view to be
For tests of some small JBoss enterprise apps I would like to use JUnit,
Here is a small example of my problem, and I havent been able to
I would like to writing a small C program that runs an infinite loop
To better explain what I'm trying to achieve, here's a simple example: Scenario 1
Here is a small reproducible example of my data: > mydata <- structure(list(subject =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.