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

conflict with namespace and outputDirectory using maven #36

Open
ppdouble opened this issue Apr 8, 2023 · 0 comments
Open

conflict with namespace and outputDirectory using maven #36

ppdouble opened this issue Apr 8, 2023 · 0 comments

Comments

@ppdouble
Copy link

ppdouble commented Apr 8, 2023

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.

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

No branches or pull requests

1 participant