Git Product home page Git Product logo

maven-thrift-plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maven-thrift-plugin's Issues

conflict with namespace and outputDirectory using maven

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>nd.pemo</groupId>
    <artifactId>thrift-rpc-sample-client</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.thrift</groupId>
            <artifactId>libthrift</artifactId>
            <version>0.18.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>clean generate-sources compile install</defaultGoal>

        <plugins>
            <plugin>
                <groupId>org.apache.thrift.tools</groupId>
                <artifactId>maven-thrift-plugin</artifactId>
                <version>0.1.11</version>
                <configuration>
                    <generator>java</generator>
                    <thriftExecutable>/usr/bin/thrift</thriftExecutable>
                    <thriftSourceRoot>${basedir}/src/main/resources/thrift</thriftSourceRoot>
                    <outputDirectory>${basedir}/src/main/java/thrift</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>thrift-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
namespace java thrift.rpc.api.user
namespace cpp thrift.rpc.api.user

struct LoginRequest {
  1: string username,
  2: string password
}

struct APIResponse {
  1: string responsemessage,
  2: i32 responseCode
}

# empty for logout request
struct Empty {
}

# specific response for logout
struct LogoutResponse {
  1: string logoutmessage,
  2: i32 responseCode
}


service User {
  APIResponse login(1:LoginRequest loginRequest);

  LogoutResponse logout(1:Empty empty);

}

The namespace java thrift.rpc.api.user will append another thrift to <outputDirectory>${basedir}/src/main/java/thrift</outputDirectory>. So, it will be src/main/java/thrift/thrift/rpc/api/user. The package of generated classes would be wrong.

NPE with java:beans generator

I am using Thrift 0.6.0 with the 0.1.10 thrift plugin. If I use

java:beans

I get a NPE with the following stack trace
java.lang.NullPointerException
at org.apache.thrift.maven.Thrift.moveGeneratedFiles(Thrift.java:117)
at org.apache.thrift.maven.Thrift.compile(Thrift.java:85)
at org.apache.thrift.maven.AbstractThriftMojo.execute(AbstractThriftMojo.java:158)
at org.apache.thrift.maven.ThriftCompileMojo.execute(ThriftCompileMojo.java:22)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
...

This happens because with the java:beans generator, the code is output into the "gen-javabean" directory. However, Thrift.java defines GENERATED_JAVA to be "gen-java" and this causes the NPE. Not sure what the recommended fix is but I would be happy to spin up a patch after discussion.

Thrift compatibility

It seems the plugin is not compatible with latest thrift version (Apache Thrift v0.11.0). Could any one please suggest the solution or alternatives?

Create a license file

Each of the source files carries a license blob but it would be good to have a project level license file as well

Problems with m2e + Eclipse 3.7

I just upgraded my environment to Eclipse 3.7 (Indigo) and the m2e plugin (using the 0.1.11 maven-thrift-plugin). m2e now complains about "Plugin execution not covered by lifecycle configuration" for the maven-thrift-plugin.

More information on this problem can be found at http://wiki.eclipse.org/M2E_plugin_execution_not_covered and, while one could always set the plugin to always execute, I think it might be better to "delegate". Any recommendations on what the preferred config should be? I am not completely familiar with how the thrift plugin/maven plugin ecosystem. Happy to experiment and report back on suggestions.

README file give bad pom.xml example

What user can expect:

  • mvn generate-sources generate the sources for the main folder
  • mvn generate-test-sources generate the sources for the test folder

What it should be writted:

<executions>
    <execution>
        <phase>generate-sources</phase>
        <goals>
            <goal>compile</goal>
        </goals>
    </execution>
    <execution>
        <phase>generate-test-sources</phase>
        <goals>
            <goal>testCompile</goal>
        </goals>
    </execution>
</executions>

[ERROR] thrift failed error: !!! Unrecognized option: -out

I am trying to make a mvn clean install using.. the following maven file and this is what I get:
[ERROR] thrift failed error: !!! Unrecognized option: -out

this is my file

4.0.0 logtrust thrifttest 0.0.1-SNAPSHOT org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 org.apache.thrift.tools maven-thrift-plugin 0.1.12-SNAPSHOT /opt/local/bin/thrift thrift-java-generation java src/main/java true compile
            </executions>
        </plugin>
    </plugins>
</build>
org.apache.thrift libthrift 0.6.1
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.8</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>
</dependencies>

Version 0.1.11+ breaks Thrift 0.5.0 compatibility

The buildThriftCommand method in Thrift.java generates a -out param which isn't recognised. In earlier versions of Thrift -- well, 0.5.0 which is the only one I've tried -- this should be -o.

Feel free to mark as WONTFIX if backwards compat. isn't a goal :-)

Should not clean original files

If I specify outputDirectory as ./src/main/java/, it will cleanup all my source files in ./src/main/java.

I would like generate the thrift java files so that the same project could import and use it. But if I set the outputDirectory as the path of my source code, it will cleanup all files.

multiple idl files

Hello,

Is there a way to invoke this plugin for multiple idl files?

Note that in my case, there is no parent/shared folder that contains my separate idls, I cannot afford to pass a common root folder and recursively generate code for all thrift files below it.

Thanks

Support multiple invocations?

Feature suggestion: it would be cool if it were possible to have multiple invocations of the thrift compiler, varying the param in order to generate source for multiple languages.

build problems

Enviroment:
openjdk version "1.8.0"
OpenJDK Runtime Environment (build 1.8.0-b132)
OpenJDK Server VM (build 25.0-b70, mixed mode)

Apache Maven 3.2.1
Maven home: /usr/share/maven
Java version: 1.8.0-b132, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.0/jre
Default locale: it_IT, platform encoding: UTF-8
OS name: "linux", version: "3.13.7-100.fc19.i686", arch: "i386", family: "unix"

[ERROR] /rpmbuild/BUILD/maven-thrift-plugin-thrift-maven-plugin-0.1.12/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java:[54,22] method addTestResource in interface org.apache.maven.project.MavenProjectHelper cannot be applied to given types;
required: org.apache.maven.project.MavenProject,java.lang.String,java.util.List<java.lang.String>,java.util.List<java.lang.String>
found: org.apache.maven.project.MavenProject,java.lang.String,com.google.common.collect.ImmutableList<java.lang.String>,com.google.common.collect.ImmutableList<java.lang.Object>
reason: actual argument com.google.common.collect.ImmutableList<java.lang.Object> cannot be converted to java.util.List<java.lang.String> by method invocation conversion
[ERROR] /rpmbuild/BUILD/maven-thrift-plugin-thrift-maven-plugin-0.1.12/src/main/java/org/apache/thrift/maven/ThriftCompileMojo.java:[79,22] method addResource in interface org.apache.maven.project.MavenProjectHelper cannot be applied to given types;
required: org.apache.maven.project.MavenProject,java.lang.String,java.util.List<java.lang.String>,java.util.List<java.lang.String>
found: org.apache.maven.project.MavenProject,java.lang.String,com.google.common.collect.ImmutableList<java.lang.String>,com.google.common.collect.ImmutableList<java.lang.Object>
reason: actual argument com.google.common.collect.ImmutableList<java.lang.Object> cannot be converted to java.util.List<java.lang.String> by method invocation conversion

any ideas?
thanks in advance
regards

Generate hashCode() method using org.apache.commons.lang3.builder.HashCodeBuilder

Build maven project via maven-thrift-plugin, the pom as below. The java class generated by thrift has hashcode method, which is using org.apache.commons.lang3.builder.HashCodeBuilder.
But when I generate java code by thrift command in terminal, the hashcode method will not be using HashCodeBuilder.

Using HashCodeBuilder need to add a common-lang3 dependency, and the package jar will be different with the others.

What can I do to avoid HashCodeBuilder?

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.thrift.tools</groupId>
                <artifactId>maven-thrift-plugin</artifactId>
                <version>0.1.11</version>
                <configuration>
                    <thriftExecutable>thrift</thriftExecutable>
                </configuration>
                <executions>
                    <execution>
                        <id>thrift-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>thrift-test-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.