例:
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/resources/dir1</schemaDirectory>
<schemaIncludes>
<include>schema1.xsd</include>
</schemaIncludes>
<generatePackage>schema1.package</generatePackage>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>src/main/resources/dir2</schemaDirectory>
<schemaIncludes>
<include>schema2.xsd</include>
</schemaIncludes>
<generatePackage>schema2.package</generatePackage>
</configuration>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
发生了什么:Maven执行第一个插件.然后删除目标文件夹并创建第二个包,然后该包可见.
我尝试为第一个配置设置target/somedir1,为第二个配置设置target/somedir2.但这种行为并没有改变?有任何想法吗?我不想直接在src/main/java文件夹中生成包,因为这些包是经过处理的,不应与手动创建的类混合使用.
我正在使用maven插件maven-jaxb2-plugin从XSD Schema文件生成POJO.这很好用.唯一让我困扰的是,xml架构枚举没有映射到Java Enum Type中.
我的maven插件是从我称为schemachooser.xsd的文件生成java pojos
schemachooser.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sch="http://www.ascc.net/xml/schematron"
targetNamespace="http://schema.something" elementFormDefault="qualified"
version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc" jaxb:version="1.0">
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings generateIsSetMethod="true" fixedAttributeAsConstantProperty="true">
<xjc:serializable />
</jaxb:globalBindings>
<jaxb:schemaBindings>
<jaxb:bindings node="//xsd:element[@name='ElementName']/xsd:simpleType">
<jaxb:typesafeEnumClass name="MyEnumType" />
</jaxb:bindings>
</jaxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
<xs:include schemaLocation="myNormalSchema.xsd" />
</schema>
Run Code Online (Sandbox Code Playgroud)
它确实生成文件,但不生成"新"枚举类"MyEnumType".我使用绑定错了吗?
在我的maven~./.m2/settings.xml中我定义了一个镜像和一些存储库:
<mirrors>
<mirror>
<id>someid</id>
.....
</mirro>
</mirrors>
...
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository> <id>repo....</id>
....
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
这很好用.
有些项目我想要禁用镜像和默认配置文件.我知道我可以为存储库定义一个单独的配置文件,但我不知道如何告诉maven eclipse插件不使用默认配置文件或特定配置文件.另外:如何更改项目的镜像?
在jsf页面中使用commandButton下载文件.使用:JSF和Richfaces.
我有一个表(扩展ExtendedDataModel实现可修改,可序列化)与一些数据,并在每一行按钮"下载".
<a4j:commandButton id="getDownload" value="download"
style="margin-left:10px;margin-right:10px;width:100px;"
action="#{controller.download}" immediate="true" ajaxSingle="true">
<f:setPropertyActionListener target="#{controller.idString}" value="#{item.id}" />
</a4j:commandButton>
Run Code Online (Sandbox Code Playgroud)
我必须在控制器中构建文件:
public void download(){
OutputStream out = null;
....
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse();
out = response.getOutputStream();
ZipOutputStream zipout = new ZipOutputStream(out);
.....
zipout.close();
response.setContentType("application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\""+filename+"\"");
out.flush();
....
} finally {
try {
if (out!=null){
out.close();
}
FacesContext.getCurrentInstance().responseComplete();
} catch (IOException e) {
logger.error(e);
}
}
...
}
Run Code Online (Sandbox Code Playgroud)
当我实现ExtendedDataModel时,问题就开始了.起初我使用了h:commandLink,但是控制器方法从未被调用过...我试过......现在调用了正确的方法,但是(zip)文件内容显示在页面中.我想在页面中有一个按钮/链接,用户可以单击该链接下载文件.页面本身不应该改变.有任何想法吗?
我可以创建一个servlet,但我不明白为什么ExtendedDataModel改变了里面链接的行为.
EDIT1
我用了
<h:commandLink id="getDownload" value="download" action="#{controller.download}">
<f:setPropertyActionListener target="#{controller.idString}" value="#{item.id}" /> …Run Code Online (Sandbox Code Playgroud) I have just finished the book "couchdb: a definitive guide" and started to play with design documents. there is however one thing, that I do not understand. All the examples I have seen so far are somewhat linear.
Example:
{
"_id": "1",
"_rev": ".....",
"name": "first",
"something": "blue",
"child": "2"
}
{
"_id": "2",
"_rev": ".....",
"name": "second",
"something": "green",
"child": "3"
"parent" : "1"
}
{
"_id": "3",
"_rev": ".....",
"name": "second",
"something": "red",
"parent" : "2";
}
Run Code Online (Sandbox Code Playgroud)
I …
我试图将oracle过程调用的out参数强制转换为对象.它不起作用,因为 - 据我所知 - 我需要定义一个地图,告诉方法如何施放它.如果地图是emtpy或不正确填充的,它默认为STRUCT类型的Objekt - 这在我的情况下是错误的.
我已经构建了一个示例,它应该说明问题:
-- Procedure in database
PROCEDURE myprocedure (
inputParam IN VARCHAR2 (4),
outputOne OUT outputOneSQLType
outputTwo OUT outputTwoSQLType);
-- inside of a package
inside a package mypackage
-- first type
create or replace
TYPE outputOneSQLType IS TABLE OF tableOneExample
-- table of type
create or replace
TYPE tableOneExample AS OBJECT (
somethingOne VARCHAR2 (4)
,somethingTwo NUMBER (12)
)
//java from here
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes;
import oracle.jdbc.oracore.OracleTypeADT;
import oracle.sql.STRUCT;
...
oracle.jdbc.driver.OracleConnection oracleConn = …Run Code Online (Sandbox Code Playgroud) 这是问题:我有一个remoteForm,它本身工作正常.我调试了控制器,每个命令都会运行.但是,如果发生异常并且我设置了flash.error消息.仅在我手动按F5(刷新)后才会显示该消息.我不明白为什么AJAX调用有效,但flash消息是空的.
我有一个远程表单(在index.gsp中):
...
<g:formRemote name="remoteForm"
url="[ controller: 'document',
action: 'search']"
onLoading="showSpinner();"
update="searchBlock"
action="${createLink(controller: 'document', action:'search')}"
>
<div class='info_message'>
${flash.message}
</div>
<div id="searchBlock">will be exchanged</div>
......
Run Code Online (Sandbox Code Playgroud)
控制器:
......
} catch (Exception e){
log.error(e)
flash.error = e.getMessage()
flash.message="HINTTEST"
render (template:'searchNoResult')
return
}
.....
Run Code Online (Sandbox Code Playgroud)
模板(_searchNoResult)具有以下内容:
<span>Sorry, your search yielded no result.</span>
<g:if test='${flash.error}'>
<div class='error_message'>
Error: ${flash.error}
</div>
</g:if>
<g:if test='${flash.messages}'>
<div class='info_message'>
Hint: ${flash.message}
</div>
</g:if>
Run Code Online (Sandbox Code Playgroud)
文档说明:闪存范围通过当前请求和之后的调用.如果我使用普通表单并提交一切正常,但我想使用ajax和渲染模板,所以我不必经常重复代码.
编辑1 首先渲染index.gsp.remoteForm使用包含flash.messages的模板更改seachBlock div.他们没有被填补.
Grails版本1.3.7目前无法升级.
编辑2 异常e,不是Exception,它是我原创的.消息为null,导致消息为null ....
我正在测试 Wildfly 可启动罐子。做了一个简单的项目并用“java -jar myapp-bootable.jar”启动它就好了。它基本上只包含一个index.html。够简单的。
下一步是围绕它构建一个 docker 镜像。但这不起作用。
这是 dockerfile
FROM maven:3.6.3-adoptopenjdk-15 as build
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
RUN mvn -f /usr/src/app/pom.xml clean package
FROM adoptopenjdk:latest
COPY --from=build /usr/src/app/target/myapp-bootable.jar /opt/myapp-bootable.jar
WORKDIR /opt
CMD ["java", "-jar","myapp-bootable.jar"]
Run Code Online (Sandbox Code Playgroud)
我在我的Mac上使用相同的jdk并且它确实有效。我真的不明白为什么会收到此错误消息:
Exception in thread "main" java.lang.Exception: org.jboss.modules.ModuleLoadException: Error loading module from /tmp/wildfly-bootable-server4167855925626750470/modules/system/layers/base/org/apache/xerces/main/module.xml
at org.wildfly.core.jar.boot.Main.runBootableJar(Main.java:162)
at org.wildfly.core.jar.boot.Main.main(Main.java:141)
Caused by: org.jboss.modules.ModuleLoadException: Error loading module from /tmp/wildfly-bootable-server4167855925626750470/modules/system/layers/base/org/apache/xerces/main/module.xml
at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:337)
at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:293)
at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:254)
at org.jboss.modules.LocalModuleFinder.parseModuleXmlFile(LocalModuleFinder.java:250)
at org.jboss.modules.LocalModuleFinder.lambda$findModule$1(LocalModuleFinder.java:195)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
at org.jboss.modules.LocalModuleFinder.findModule(LocalModuleFinder.java:195)
at org.jboss.modules.ModuleLoader.findModule0(ModuleLoader.java:696)
at org.jboss.modules.ModuleLoader.findModule(ModuleLoader.java:689)
at …Run Code Online (Sandbox Code Playgroud)