私は freemarker を使用するプロジェクトに取り組んでおり、この種の呼び出しを行う必要があります:
messageContent.append(FreeMarkerTemplateUtils.processTemplateIntoString( freemarkerConfig.getConfiguration () .getTemplate("sampleTemplate.ftl"), モデル));
しかし、mvn clean package を実行しようとすると、
「freemarker.template.Configurationにアクセスできません[エラー] freemarker.template.Configurationのクラスファイルが見つかりません」.
Configuration オブジェクトを明示的に作成しようとすると(Configuration config = new Configuration())
、予想どおり、Eclipse は「freemarker.template.Configuration」をインポートすることを推奨します。それをインポートすると、Eclipse でエラーがなくなりますが、もう一度実行しようとするとmvn clean package
、「パッケージ freemarker.template が存在しません」というエラーが表示されてビルドに失敗します。
私のpomファイルには次のものがあります:
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
<scope>runtime</scope>
</dependency>
他に何かする必要がありますか?前もって感謝します!