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 804653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:57:14+00:00 2026-05-14T23:57:14+00:00

Example: </plugin> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.7.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration>

  • 0

Example:

</plugin>       
       <plugin>
           <groupId>org.jvnet.jaxb2.maven2</groupId>
           <artifactId>maven-jaxb2-plugin</artifactId>
           <version>0.7.1</version>
           <executions>
             <execution>
               <goals>
                 <goal>generate</goal>
               </goals>
             </execution>
           </executions>
            <configuration>
             <schemaDirectory>src/main/resources/dir1</schemaDirectory>
              <schemaIncludes>
                  <include>schema1.xsd</include>
              </schemaIncludes>
              <generatePackage>schema1.package</generatePackage>
           </configuration>
         </plugin>
          <plugin>
           <groupId>org.jvnet.jaxb2.maven2</groupId>
           <artifactId>maven-jaxb2-plugin</artifactId>
           <version>0.7.1</version>
           <executions>
             <execution>
               <goals>
                 <goal>generate</goal>
               </goals>
             </execution>
           </executions>
            <configuration>
             <schemaDirectory>src/main/resources/dir2</schemaDirectory>
              <schemaIncludes>
                  <include>schema2.xsd</include>
              </schemaIncludes>
              <generatePackage>schema2.package</generatePackage>
           </configuration>
         </plugin>
       </plugins>

What happened:
Maven executes the the first plugin. Then deletes the target folder and creates the second package, which then is visible.

I tried to set target/somedir1 for the first configuration and target/somedir2 for the second configuration. But the behavior does not not change? Any ideas? I do not want to generate the packages directly in the src/main/java folder, because these packages are genereated and should not be mixed with manual created classes.

  • 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-14T23:57:15+00:00Added an answer on May 14, 2026 at 11:57 pm

    I had to specify different generateDirectory (without this, the plugin was considering that files were up to date and wasn’t generating anything during the second execution). And I recommend to follow the target/generated-sources/<tool> convention for generated sources so that they will be imported in your favorite IDE automatically. I also recommend to declare several execution instead of declaring the plugin twice (and to move the configuration inside each execution element):

    <plugin>
      <groupId>org.jvnet.jaxb2.maven2</groupId>
      <artifactId>maven-jaxb2-plugin</artifactId>
      <version>0.7.1</version>
      <executions>
        <execution>
          <id>schema1-generate</id>
          <goals>
            <goal>generate</goal>
          </goals>
          <configuration>
            <schemaDirectory>src/main/resources/dir1</schemaDirectory>
            <schemaIncludes>
              <include>shiporder.xsd</include>
            </schemaIncludes>
            <generatePackage>com.stackoverflow.package1</generatePackage>
            <generateDirectory>${project.build.directory}/generated-sources/xjc1</generateDirectory>
          </configuration>
        </execution>
        <execution>
          <id>schema2-generate</id>
          <goals>
            <goal>generate</goal>
          </goals>
          <configuration>
            <schemaDirectory>src/main/resources/dir2</schemaDirectory>
            <schemaIncludes>
              <include>books.xsd</include>
            </schemaIncludes>
            <generatePackage>com.stackoverflow.package2</generatePackage>
            <generateDirectory>${project.build.directory}/generated-sources/xjc2</generateDirectory>
          </configuration>
        </execution>
      </executions>
    </plugin>
    

    With this setup, I get the following result after a mvn clean compile

    $ tree target/
    target/
    ├── classes
    │   ├── com
    │   │   └── stackoverflow
    │   │       ├── App.class
    │   │       ├── package1
    │   │       │   ├── ObjectFactory.class
    │   │       │   ├── Shiporder.class
    │   │       │   ├── Shiporder$Item.class
    │   │       │   └── Shiporder$Shipto.class
    │   │       └── package2
    │   │           ├── BookForm.class
    │   │           ├── BooksForm.class
    │   │           ├── ObjectFactory.class
    │   │           └── package-info.class
    │   ├── dir1
    │   │   └── shiporder.xsd
    │   └── dir2
    │       └── books.xsd
    └── generated-sources
        ├── xjc
        │   └── META-INF
        │       └── sun-jaxb.episode
        ├── xjc1
        │   └── com
        │       └── stackoverflow
        │           └── package1
        │               ├── ObjectFactory.java
        │               └── Shiporder.java
        └── xjc2
            └── com
                └── stackoverflow
                    └── package2
                        ├── BookForm.java
                        ├── BooksForm.java
                        ├── ObjectFactory.java
                        └── package-info.java
    

    Which seems to be the expected result.

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

Sidebar

Related Questions

I am creating .ear using maven <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>2.6</version> <configuration> <finalName>wsformatter-ear</finalName> <includeLibInApplicationXml>true</includeLibInApplicationXml> <version>1.4</version>
I have the following Maven code snippet <plugin> <!-- http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin --> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.16</version>
I use Jboss-Maven-Plugin by 1.4 version. I look JBoss Maven Plugin Usage Example ,And
I have a maven project of the form <project> <groupId>com.example.project</groupid> <artifactId>project</artifactId> <module>module1</module> <module>module2</module> <module>module3</module>
TL;DR version: I want to be able to use the Maven Mojo SQL Plugin
I'm using Maven GAE plugin with JDO, I started with jappstart example (https://github.com/tleese22/google-app-engine-jappstart/blob/master/pom.xml), but
I've been following the example on the maven-ear-plugin site that shows how to add
Take the following example plugin: (function($) { $.fn.alertOnClick = function(text) { return this.each(function(){ $(this).click(alert(text));
I am trying to implement a timestamp example plugin given in the www.ckeditor.com. But
Does jQuery validation plugin have some dependencies? For example, I saw blogposts that said

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.