Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to Maven plugin that allows Jackson annotations to be omitted #52

Closed
joelittlejohn opened this issue Jun 23, 2013 · 9 comments
Closed

Comments

@joelittlejohn
Copy link
Owner

Original author: ottofoni...@gmail.com (July 03, 2012 18:55:14)

Interested in POJO with no extra content.
Without @JsonSerialize, @generated,@JsonPropertyOrder.
Thanks.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=52

@joelittlejohn
Copy link
Owner Author

From PaulGr...@gmail.com on July 03, 2012 22:49:36
I've also had a look at this. I didn't modify the plugin, instead used a Maven profile which uses Ant to rewrite the output. It's hacky but seems to work well enough.

jsonschema2pojo-jackson1 maven-antrun-plugin 1.7 fix-for-java-1.4 generate-sources run org.apache.ant ant-nodeps 1.8.1

@joelittlejohn
Copy link
Owner Author

From ottofoni...@gmail.com on July 04, 2012 08:45:37
Thanks a lot for a quick solution.
After removing some whitespaces in Regexp-s and placing
default-cli as execution id (to run from command line), it
perfectly suits my needs.

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on July 04, 2012 17:45:11
This is clearly going to be a useful enhancement. Thanks for raising it (and thanks Paul for providing your workaround). I'm tentatively attaching 0.3.1 to this as I'd like to get it into the next release.

I've always intended to try to support JSON libraries other than Jackson. I like the idea of a new config property 'annotationStyle' that currently supports the values JACKSON (default) and NONE.

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on July 16, 2012 22:46:59
This is now fixed (r2f82543cf75b) and will be included in 0.3.1.

The plugin now supports a new configuration property 'annotationStyle'. Supported values are JACKSON (default) and NONE. This config param is also available for the ant task and cli (see docs on release for details).

@joelittlejohn
Copy link
Owner Author

From PaulGr...@gmail.com on July 17, 2012 16:18:11
Hi Joe, how is the NONE value used in a pom.xml?

I get this output:

[INFO] Failed to configure plugin parameters for: com.googlecode.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.3.1-SNAPSHOT

(found static expression: 'NONE' which may act as a default value).

Cause: Cannot assign configuration entry 'annotationStyle' to 'class com.googlecode.jsonschema2pojo.AnnotationStyle' from 'NONE', which is of type class java.lang.String

from this config:

        <plugin>
            <groupId>com.googlecode.jsonschema2pojo</groupId>
            <artifactId>jsonschema2pojo-maven-plugin</artifactId>
            <version>0.3.1-SNAPSHOT</version>
            <configuration>
                <annotationStyle>NONE</annotationStyle>
            </configuration>

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on July 17, 2012 16:25:59
Paul, which version of Maven are you using?

@joelittlejohn
Copy link
Owner Author

From PaulGr...@gmail.com on July 17, 2012 17:57:50
This test was version 2.2.1. I use a different version at work than at home (3.0.4).

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on July 17, 2012 22:13:55
Looks like this is a Maven 3 vs Maven 2 issue. Support for enums as config values was only introduced in v3:

http://jira.codehaus.org/browse/MNG-4292

I'll have to switch this to a String and keep the enum for internal use. Time to reopen this I think.

This was a great spot Paul, thanks for trying this SNAPSHOT and reporting the issue!

@joelittlejohn
Copy link
Owner Author

From joelittl...@gmail.com on July 18, 2012 20:57:28
I've just pushed some changes to fix your issue Paul, feel free to try again.

One nice side effect of this change is that the config value is now case insensitive, so there's no need to use all caps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant