freemarker.template.TemplateNotFoundException: Template not found for name “xxx.ftl“

根据报错信息提示是xxx.ftl模板不存在,但是在项目目录中确实存在该xxx.ftl文件

检查发现:这是因为ftl文件放置在java目录下,在idea中编译的时候没有将ftl文件编译导classes目录中,导致在运行的时候找不到所需要的文件

解决办法:1、可以手动将该文件放置在classes对应的目录下即可。

2、在pom.xml中使用如下进行设置:

<resources>
    <resource>
		<directory>${basedir}/src/main/java</directory>
		<includes>
		    <include>**/*.*</include>
	    </includes>
		<excludes>
			<exclude>**/*.java</exclude>
		</excludes>
		<filtering>false</filtering>
    </resource>
</resources>

 

要使用Java开发Template.kml文件,您可以使用Google提供的KML API来生成KML文件。这个API提供的类和方法可以帮助您快速生成KML文件,并进行必要的编辑和调整。 以下是一个简单的示例代码,用于生成一个KML文件: ```java import com.google.earth.kml._2.KmlType; import com.google.earth.kml._2.PlacemarkType; import com.google.earth.kml._2.PointType; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import java.io.File; public class TemplateKMLGenerator { public static void main(String[] args) throws JAXBException { // 创建KML对象 KmlType kml = new KmlType(); PlacemarkType placemark = new PlacemarkType(); placemark.setName("无人机航拍路径"); PointType point = new PointType(); point.getCoordinates().add("经度,纬度,高度"); placemark.setPoint(point); // 将Placemark添加到KML中 kml.getAbstractFeatureGroup().add(placemark); // 将KML对象写入文件 JAXBContext jaxbContext = JAXBContext.newInstance(KmlType.class); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(kml, new File("template.kml")); } } ``` 在这个例子中,我们创建了一个KmlType对象,并向其中添加了一个PlacemarkType对象,用于表示无人机的航拍路径。然后,我们使用JAXBContext和Marshaller将KmlType对象写入到template.kml文件中。 请注意,这只是一个简单的示例代码,创建KML文件的具体实现可能会因应用场景而有所不同。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值