设置了compilerArgument无效

发布于 2021-12-04 06:07:45 字数 2163 浏览 1007 评论 1

maven配置:

<!-- 编译插件 -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5.1</version>
    <configuration>
        <!-- 源码风格使用1.7风格 -->
        <source>1.8</source>
        <target>1.8</target>
        <encoding>UTF-8</encoding>
        <!--必须添加compilerArgument配置,才能使用JFinal的Controller方法带参数的功能-->
        <compilerArgument>-parameters</compilerArgument>
        <!--<compilerArgs>-->
            <!--<compilerArg>-parameters</compilerArg>-->
        <!--</compilerArgs>-->
        <!-- 编译跳过代码编译类 -->
        <excludes>
            <!-- 排除应用程序编译类 -->
            <exclude>**/ApplicationCodeGenerator.java</exclude>
        </excludes>
    </configuration>
</plugin>

maven编译日志

[DEBUG] Goal:          org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile (default-testCompile)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <basedir default-value="${basedir}"/>
  <buildDirectory default-value="${project.build.directory}"/>
  <classpathElements default-value="${project.testClasspathElements}"/>
  <compileSourceRoots default-value="${project.testCompileSourceRoots}"/>
  <compilerArgument>-parameters</compilerArgument>
[DEBUG]   (f) compileSourceRoots = [/data/lib/jenkins/workspace/component-system/jzdoctor-component/jzdoctor-component-system/src/main/java]
[DEBUG]   (f) compilerArgument = -parameters
[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) debug = true
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) excludes = [**/ApplicationCodeGenerator.java]

运行警告信息:

Oct 31, 2018 10:03:13 PM com.jfinal.core.paragetter.ParaProcessorBuilder warn
WARNING: you should add compiler flag -parameters to support parameter auto binding

 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谢绝鈎搭 2021-12-07 13:29:25

经过仔细排查,偶然灵机一闪,发现是因为依赖造成的!!!

主工程依赖了一个api组件以及kit组件,主工程虽然指定了compilerArgument参数,但是api组件以及kit组件在打包的时候并未指定compilerArgument参数。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文