Java files not getting generated with mvn package

1,402 views
Skip to first unread message

sameer.b...@gmail.com

unread,
Dec 13, 2013, 2:16:39 AM12/13/13
to jsonschema...@googlegroups.com
I am using the maven plugin  jsonschema2pojo-maven-plugin to generate the  the pojos using the same address schema. I don't see the java files generated when I run the mvn package command, however if I manually execute the goal in the plugin it works fine. 
I am using, mvn generate-sources  org.jsonschema2pojo:jsonschema2pojo-maven-plugin:generate

Am I missing something I have followed the exact steps mentioned in the wiki https://github.com/joelittlejohn/jsonschema2pojo/wiki/Getting-Started#the-maven-plugin

Please help!

Thanks,
Sameer.

Joe Littlejohn

unread,
Dec 13, 2013, 5:50:24 AM12/13/13
to jsonschema...@googlegroups.com
Hi Sameer,

What version of Maven are you using? Also, could you show your plugin configuration? By default the plugin should bind to the generate-sources phase, so running mvn package should obviously invoke it. I can't think of any reason why it would not run.

Feel free to send me a zipped copy of your project if this is possible and I'll take a look.

Cheers


--
You received this message because you are subscribed to the Google Groups "jsonschema2pojo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsonschema2pojo-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sameer Bhadouria

unread,
Dec 13, 2013, 2:14:08 PM12/13/13
to jsonschema...@googlegroups.com
Hi John,

Thanks for the quick response. I am using maven 2.2.1. I am using Java 7 but I have tried with Java 6 with no success.  I have attached a test project zip.

Here is my build configuration. 

 <build>

    <pluginManagement>

      <plugins>

         <plugin>

         <!-- Currently only working manually -->

         <!-- mvn generate-sources  org.jsonschema2pojo:jsonschema2pojo-maven-plugin:generate -->

              <groupId>org.jsonschema2pojo</groupId>

              <artifactId>jsonschema2pojo-maven-plugin</artifactId>

              <version>0.4.0</version>

              <configuration>

                  <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>

                  <targetPackage>com.test</targetPackage>

              </configuration>

              <executions>

                  <execution>

                      <goals>

                          <goal>generate</goal>

                      </goals>

                  </execution>

              </executions>

          </plugin>

          <plugin>

             <groupId>org.apache.maven.plugins</groupId>

             <artifactId>maven-compiler-plugin</artifactId>

             <version>3.1</version>

             <configuration>

                 <source>1.6</source>

                 <target>1.6</target>

             </configuration>

         </plugin>

      </plugins>

    </pluginManagement>

  </build>


I also have the following 2 dependencies in my pom.xml

<dependency>

        <groupId>commons-lang</groupId>

        <artifactId>commons-lang</artifactId>

        <version>2.4</version>

     </dependency>

     <dependency>

        <groupId>com.fasterxml.jackson.core</groupId>

        <artifactId>jackson-databind</artifactId>

        <version>2.0.0</version>

     </dependency>


Thanks!



--
You received this message because you are subscribed to a topic in the Google Groups "jsonschema2pojo-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jsonschema2pojo-users/ZlBT-5BFBu0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jsonschema2pojo-...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Regards,
Sameer Bhadouria.
json2pojo.zip

Joe Littlejohn

unread,
Dec 14, 2013, 9:42:51 AM12/14/13
to jsonschema...@googlegroups.com, sameer.b...@gmail.com
Sameer,

The problem here is that you have put the plugin configuration into pluginManagement, this section is used to define configuration for your subprojects so it doesn't actually cause the plugin to execute. You should move your plugin definition out of 'pluginManagement' and into 'plugins' instead.

For more details see:



Joe

To unsubscribe from this group and stop receiving emails from it, send an email to jsonschema2pojo-users+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "jsonschema2pojo-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jsonschema2pojo-users/ZlBT-5BFBu0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jsonschema2pojo-users+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Regards,
Sameer Bhadouria.
Reply all
Reply to author
Forward
0 new messages