<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> <java.version>10</java.version> <maven.compiler.source>10</maven.compiler.source> <maven.compiler.target>10</maven.compiler.target> </properties>
在Maven中,主要有3个插件可以用来打包:
登录后复制
1.maven-jar-plugin,默认的打包插件,用来打普通的project JAR包;
2.maven-shade-plugin,用来打可执行JAR包,也就是所谓的fat JAR包;
3.maven-assembly-plugin,支持自定义的打包结构,也可以定制依赖项等。
可执行jar包(maven-shade-plugin)
<project> <groupId>shade.test</groupId> <artifactId>shade.test</artifactId> <version>1.0-SNAPSHOT</version> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>Main</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins> </build> ... </project>
https://blog.csdn.net/u011624157/article/details/118077267
java.lang.runtimeexception: unable to find function
https://sourceforge.net/p/geotools/mailman/geotools-gt2-users/thread/19998467.post@talk.nabble.com/
I can help with that one ... we make use of Factory Service Provider Interface (ie Factory SPI) which makes use of META_INF/services/* (a folder in your jar that advertises all the services the jar offers - including the length function). So when you do mvn assembly - you will need to make sure the META_INF/services files are all merged up (no I don't know how to do this). The length function is being called when you make an attribute type; the shapefile header has a limitation that strings can only be 256 characters long; we represent that as a restriction - the restriction that "length( . ) < 256".
我可以帮你。。。我们使用工厂服务提供商接口(即工厂SPI),使用META_INF/services/*(a您的jar中的文件夹,用于宣传jar提供的所有服务-包括长度函数)。
因此,当你进行mvn组装时,你需要确保META_INF/services文件都被合并了(不,我不知道怎么做)。
当您创建属性类型时,将调用length函数;这个shapefile头具有字符串只能为256的限制字符长;我们将其表示为一种限制“长度(.)<256”。
I have exactly the same problem that John had from the same source, implementing the "How to read a shapefile example". I have read Jody's response and tried to implement it. I don't have any problem including something in the META-INF/servies folder in the jar. I know how to do that. But I haven't been able to figure out what to include. I tried following the directions in the API for implementing a DataStoreFactorySpi. These suggest the following:
我有和约翰完全相同的问题,来自同一个来源,实现“如何读取形状文件示例”。我读过乔迪的响应并尝试实施它。我没有任何问题,包括jar中META-INF/servies文件夹中的某些内容。我知道怎么做。
但我一直没能弄清楚该包括什么。我试着跟随API中有关实现DataStoreFactorySpi的说明。这些建议以下内容:
[Begin quote from API] Implementation Notes An instance of this interface should exist for all data stores which want to take advantage of the dynamic plug-in system. In addition to implementing this factory interface each DataStore implementation should have a services file: META-INF/services/org.geotools.data.DataStoreFactorySpi The file should contain a single line which gives the full name of the implementing class. example: e.g. org.geotools.data.mytype.MyTypeDataSourceFacotry The factories are never called directly by client code, instead the DataStoreFinder class is used. [/End quote from API] I don't know if this is what Jody was referring to, but in any event I haven't been able to find anything that works. Can anyone provide more detail about what is required to get org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:xx) to be able to find the Length function. Will