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

生成代码无后端代码,freemarker报错 #7643

Closed
Dro9an opened this issue Dec 24, 2024 · 13 comments
Closed

生成代码无后端代码,freemarker报错 #7643

Dro9an opened this issue Dec 24, 2024 · 13 comments

Comments

@Dro9an
Copy link

Dro9an commented Dec 24, 2024

版本号:

3.7.2

问题描述:

生成代码无后端代码只有前端代码,后端freemarker关键报错如下:

2024-12-24 20:04:09.942 [http-nio-8080-exec-1] ERROR org.jeecgframework.codegenerate.generate.impl.a.a:99 - java.lang.IllegalStateException: cannot process templateString:erp/onetomany/java/${bussiPackage}/${entityPackage}/vue/V${currentDate}1__menu_insert${entityName}.sql cause:freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> currentDate [in template "templateString..." at line 1, column 60]

同样的表,从git拉取的同一个分支,使用远程数据库与redis,除jeecg_config.properties内project_path改为自己本地项目地址外其他所有配置全部一致,其他同项目开发者可以正常生成;

出现问题的开发者所有表(包括自带示例表)全部无法生成

错误截图:
image image image image image

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
@zhangdaiscott
Copy link
Member

你是什么系统

@Dro9an
Copy link
Author

Dro9an commented Dec 26, 2024

你是什么系统

我是MacOS 15,也有同事Windows11 x86_64也和我一模一样的故障症状无法生成

@zhangdaiscott
Copy link
Member

看这意思,currentDate值有问题?
本地执行这个方法看看

	/**
	 * 获取当前日期 短格式
	 */
	public static String getCurrentDateStr() {
		Date currentDate = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String formattedDate = sdf.format(currentDate);
		return formattedDate;
	}

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

看这意思,currentDate值有问题? 本地执行这个方法看看

	/**
	 * 获取当前日期 短格式
	 */
	public static String getCurrentDateStr() {
		Date currentDate = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String formattedDate = sdf.format(currentDate);
		return formattedDate;
	}

这是在出现代码生成问题项目下的start测试用例内的执行结果,看起来是正常的
image

@zhangdaiscott
Copy link
Member

你的项目路径是不是有中文或者空格

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

你的项目路径是不是有中文或者空格

确定是没有的

image

@zhangdaiscott
Copy link
Member

那神奇了,如何重现

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

我发现了100%重现步骤,代码生成不能生成到项目所在目录,但是报错信息似乎跟这个原因没有联系,选择项目外其他任意一个目录即可100%生成成功,请问这是bug吗?

@zhangdaiscott
Copy link
Member

目录有写权限吗

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

有的,父级目录以及所在目录都是有读写执行权限
image

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

包括之前提到的另外一个无法生成代码使用Windows系统环境的开发者,更换生成目录后也可以生成了

@zhangdaiscott
Copy link
Member

那还是目录权限问题

@Dro9an
Copy link
Author

Dro9an commented Dec 27, 2024

可是我在测试用例内编写的测试用例是可以正常写入文件,并且前端代码可以正常生成也佐证了权限没问题这一点,怀疑是freemaker或相关依赖的bug
image

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