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

预编译插件,一个实体被多个实体依赖时预编译中断 #208

Open
Aliang-code opened this issue Mar 4, 2024 · 5 comments
Open
Assignees

Comments

@Aliang-code
Copy link

<plugin>
                <groupId>com.baidu</groupId>
                <artifactId>jprotobuf-precompile-plugin</artifactId>
                <version>2.2.8</version>
                <configuration>
                    <filterClassPackage>com.xxx</filterClassPackage>
                    <classpathScope>compile</classpathScope>
                    <generateProtoFile>true</generateProtoFile>
                    <compileDependencies>true</compileDependencies>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>precompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

compileDependencies为true时,某个实体被多个实体依赖,在第二次检测依赖时由于预编译文件已生成而直接退出,输出以下日志:
no modify class 'xxx', will skip precompile.
看代码这里是不是应该把return改为continue呢

@jhunters jhunters self-assigned this Mar 15, 2024
@jhunters
Copy link
Owner

164行的 return 应该处理没有问题。但是 195行的return 不合理,应该是continue

@jhunters
Copy link
Owner

fix at 2.2.11
com.baidu
jprotobuf-precompile-plugin
2.2.11

@Aliang-code
Copy link
Author

fix at 2.2.11 com.baidu jprotobuf-precompile-plugin 2.2.11
有NPE

Caused by: jodd.io.findfile.FindFileException: Scan entry error: EntryData{com.*.ApiAccountUnit'}; <--- java.lang.NullPointerException
at jodd.io.findfile.ClassFinder.scanEntry(ClassFinder.java:377)
at jodd.io.findfile.ClassFinder.scanClassFile(ClassFinder.java:324)
at jodd.io.findfile.ClassFinder.scanClassPath(ClassFinder.java:307)
at jodd.io.findfile.ClassFinder.scanPath(ClassFinder.java:239)
at jodd.io.findfile.ClassFinder.scanPaths(ClassFinder.java:178)
at jodd.io.findfile.ClassScanner.scan(ClassScanner.java:35)
at jodd.io.findfile.ClassScanner.scanDefaultClasspath(ClassScanner.java:28)
at com.baidu.jprotobuf.mojo.JprotobufPreCompileMain.main(JprotobufPreCompileMain.java:182)
... 6 more
Caused by: java.lang.Exception
at com.baidu.jprotobuf.mojo.JprotobufPreCompileMain$1.onEntry(JprotobufPreCompileMain.java:144)
at jodd.io.findfile.ClassFinder.scanEntry(ClassFinder.java:375)
... 13 more
Caused by: java.lang.NullPointerException
at com.baidu.jprotobuf.mojo.JprotobufPreCompileMain.createProtoFile(JprotobufPreCompileMain.java:255)
at com.baidu.jprotobuf.mojo.JprotobufPreCompileMain.access$500(JprotobufPreCompileMain.java:42)
at com.baidu.jprotobuf.mojo.JprotobufPreCompileMain$1.onEntry(JprotobufPreCompileMain.java:136)
... 14 more

@jhunters
Copy link
Owner

收到,我分析一下

@jhunters
Copy link
Owner

npe是因为生成的Proto内容为null, 用 2.4.22 版本可以测试一下

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

2 participants