我有maven多模块项目.
A: parent.
B: child1.
C: child2.
Run Code Online (Sandbox Code Playgroud)
B将被打包以获取jar文件,然后c将使用此jar文件来编译代码.
在B中,如果我跑mvn package
,它将创建b.jar
(保持B/target/jars
不在B/target
另一个目的).
在C中,我需要使用它b.jar
来编译代码.
现在,从A,当我跑:mvn package
.首先,我成功b.jar
为B 创建文件
但是当它进入C的编译阶段时,看起来C b.jar
在类路径中无法识别(编译得到错误,因为C的代码无法从B导入类文件).
我的问题是:我该如何解决这个问题?
---------- Below
是pom文件
A: pom.xml
<groupId>AAA</groupId>
<artifactId>A</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>C</module>
<module>B</module>
</modules>
B: pom.xml
<groupId>AAA</groupId>
<artifactId>B</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<artifactId>A</artifactId>
<groupId>AAA</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
C: pom.xml
<parent>
<artifactId>A</artifactId>
<groupId>AAA</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>AAA</groupId>
<artifactId>C</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>AAA</groupId>
<artifactId>B</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
....
Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个JMS 独立应用程序来读取和写入MQSeries上的Queue.我的老板让我使用纯java JMS(不是ibm.mq lib)来做到这一点.
以下是进行jms连接所需的信息:
mq.hostname=10.10.10.10
mq.channel=API.CLIENTCHL
mq.queueManager=MQPETAPI
mq.port=1422
Run Code Online (Sandbox Code Playgroud)
你知道怎么做吗?或者你有任何链接教我这样做.
我正在使用maven-compile插件来编译类.现在我想在当前的类路径中添加一个jar文件.该文件保留在另一个位置(假设c:/jars/abc.jar.我更喜欢将此文件保留在此处).我怎样才能做到这一点?
如果我在参数中使用classpath:
<configuration>
<compilerArguments>
<classpath>c:/jars/abc.jar</classpath>
</compilerArguments>
</configuration>
Run Code Online (Sandbox Code Playgroud)
它将无法工作,因为它将覆盖当前的类路径(包括所有依赖项)
请帮我.
我正在使用maven程序集插件来打包一个jar文件.但是当我运行时mvn package
,maven总是触发[jar:jar {execution:default-jar}]来创建一个默认的jar文件.所以我将有2个jar文件(一个由程序集插件创建,另一个由maven jar创建,我不想创建).如何关闭执行:default-jar.
在我的pom.xml中,我正在使用:
<packaging>jar</packaging>
.我不想改变它<packaging>pom</packaging>
.
当我使用maven war插件时,默认情况下,此插件会将所有类文件(*.class)从目标/类复制到{warfile}/web-inf/classes.
问题是如果我编译的类(*.class)保留在另一个文件夹中:basedir/other-classes(它们是*.class文件而不是*.java文件,我知道,这很奇怪.但是这些类是从第三方).
有没有办法告诉maven war插件将(basedir/other-classes)和(target/classes)中的所有类复制到{warfile}/web-inf/classes
我正在使用maven程序集插件.在我的pom.xml中,pakaging类型:jar和我不使用maven jar插件.
每当我运行mvn clean包时,它会创建2个jar文件:一个来自maven程序集,另一个是默认创建的(由于打包类型= jar).我只想保留由程序集插件创建的jar文件.怎么做?
我试图用基本的auth消耗一个宁静的ws.我没有将任何证书导入我的密钥库.当我使用chrome插件Advance Rest client
测试它时(使用base64编码的基本身份验证用户名:pass).我可以看到回复.到现在为止还挺好.但是当我开发Java代码来使用这个ws时,我得到了SSL的失败:
org.springframework.web.client.ResourceAccessException: I/O error:
Received fatal alert: handshake_failure; nested exception is
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:377)
at test.Rest.main(Rest.java:37) Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
我的问题是:如果问题是因为我没有将证书导入我的密钥库,那么Java代码和插件都不应该一起工作.在这里,插件可以工作,但我的代码没有.是什么原因?我的代码有些不对劲?
贝娄是我的代码
RestTemplate restTemplate = new RestTemplate();
String plainCreds = "username:pass";
byte[] plainCredsBytes = plainCreds.getBytes(Charset.forName("US-ASCII") );
byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes);
String base64Creds = new String(base64CredsBytes);
HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic " + base64Creds);
ResponseEntity<String> response =
restTemplate.exchange("https://url",HttpMethod.GET,new …
Run Code Online (Sandbox Code Playgroud) 我有一个simple.jar文件,保留在c:/ JAR中.当我使用maven war插件创建war文件时,它会将所有依赖项复制到lib文件夹中.
我怎样才能让maven将simple.jar复制到lib文件夹中.
我正在尝试开发基于内容的路由骆驼应用程序.此应用程序将查看文件夹src/data以查看是否存在具有节点的SOAP请求文件<e2d:getOrderDetaiRequest>
,然后该文件将被复制到目标/消息中,否则该文件将被复制到目标/其他.
你知道如何使用xpath(或任何其他工具)来检查这个条件(我更喜欢使用camel-context.xml文件)?
这是我的骆驼语境
<route>
<from uri="file://c:/src/data?noop=true"/>
<choice>
<when>
<xpath>**???????????????????????????**</xpath>
<to uri="file://c:/target/message"/>
</when>
<otherwise>
<to uri="file://c:/target/other"/>
</otherwise>
</choice>
</route>
Run Code Online (Sandbox Code Playgroud)
这是2个不同SOAP请求的示例
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:e2d="http://www.abc.com/Abc11WS">
<soapenv:Header/>
<soapenv:Body>
<e2d:getOrderDetailRequest>
<actionCode>1234</actionCode>
</..>
</...></...>
Run Code Online (Sandbox Code Playgroud)
和
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:lsr="http://www.abc.com/Abc22WS">
<soapenv:Header/>
<soapenv:Body>
<lsr:getProductDetailsRequest>
<productId>12345</...>
</...></...></...>
Run Code Online (Sandbox Code Playgroud)