提交 63134fa6 编写于 作者: R roo00

更新javapoet

上级 fd116df3
......@@ -43,7 +43,7 @@
</delete>
<echo message="metamodel complete." />
</target>
<!--
<target name="createPersistenceXml">
<mkdir dir="${basedir}/src/main/resources/META-INF" />
<java classname="com.x.base.core.entity.tools.PersistenceXmlWriter" fork="true">
......@@ -60,12 +60,12 @@
</classpath>
<arg value="{
project:'${project}',
path:'${basedir}/src/main/resources/META-INF/x_persistence.xml'
path:'${basedir}/src/main/resources/META-INF'
}" />
</java>
<echo>${project} create persistence xml: ${basedir}/src/main/resources/META-INF/x_persistence.xml</echo>
</target>
-->
<target name="describe">
<echo>describe project:${project}</echo>
<mkdir dir="${basedir}/src/main/webapp/describe" />
......@@ -111,7 +111,7 @@
</fileset>
</classpath>
<arg value="{
path:'${basedir}/src/main/resources/META-INF/persistence.xml'
path:'${basedir}/src/main/resources/META-INF'
}" />
</java>
<sleep seconds="1" />
......
......@@ -12,6 +12,7 @@ import java.util.stream.Collectors;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
import org.apache.commons.io.FileUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
......@@ -50,7 +51,10 @@ public class EnhancePersistenceXmlWriter {
}
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("UTF-8");
XMLWriter writer = new XMLWriter(new FileWriter(new File(arg.getPath())), format);
File dir = new File(arg.getPath());
FileUtils.forceMkdir(dir);
File file = new File(dir, "persistence.xml");
XMLWriter writer = new XMLWriter(new FileWriter(file), format);
writer.write(document);
writer.close();
System.out.println("create enhance persistence.xml at path:" + arg.getPath());
......@@ -68,18 +72,6 @@ public class EnhancePersistenceXmlWriter {
}
return list.stream().sorted(Comparator.comparing(Class::getName)).collect(Collectors.toList());
}
// FastClasspathScanner scanner = new FastClasspathScanner(Packages.PREFIX);
// ScanResult scanResult = scanner.scan();
// List<Class<?>> sortedList = new ArrayList<Class<?>>();
// for (String str : scanResult.getNamesOfClassesWithAnnotationsAnyOf(MappedSuperclass.class, Entity.class)) {
// sortedList.add(Class.forName(str));
// }
// Collections.sort(sortedList, new Comparator<Class<?>>() {
// public int compare(Class<?> c1, Class<?> c2) {
// return c1.getCanonicalName().compareTo(c2.getCanonicalName());
// }
// });
// return sortedList;
}
private static Set<Class<?>> scanMappedSuperclass(Class<?> clz) throws Exception {
......
package com.x.server.console.test;
public class TestClientService {
public static void main(String[] args) {
System.setProperty("wrapper.config", "D:/aaa.conf");
WrappedService w = new WrappedService();
w.init(); // read in configuration
w.install(); // start the service
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册