我是maven的初学者,不懂很多东西.我可以构建简单的可执行jar,但是如何将multimodule maven项目构建到可执行jar中对我来说是不可思议的.所以,我有三个项目.家长:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Test</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>Main</module>
<module>Dep</module>
</modules>
</project>
Run Code Online (Sandbox Code Playgroud)
还有两个子项目:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Test</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Main</artifactId>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>Dep</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
和:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Test</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Dep</artifactId>
</project>
Run Code Online (Sandbox Code Playgroud)
主模块有Main类和main方法(lol)
public class Main {
public static void main(String[] args) {
Hello hello = new Hello();
System.out.println(hello.sayHello());
}
} …Run Code Online (Sandbox Code Playgroud) 我的json对象里面有任意值.我想在Map中反序列化它.除了将整数转换为双打外,一切都很好.见例子:
{"id":1, "inner_obj":{"key":"value","num":666,"map":{"key":"value"}}}
Run Code Online (Sandbox Code Playgroud)
反序列化为this(map.toString()):
{id=1.0, inner_obj={key=value, num=666.0, map={key=value}}}
Run Code Online (Sandbox Code Playgroud)
是否有一些简单的方法将"id"和"num"反序列化为整数而不是双打?
我想写一个基于netty的客户端.它应该有方法public String send(String msg); 哪个应该从服务器或某个未来返回响应 - doesen't不重要.它也应该是多线程的.像这样:
public class Client {
public static void main(String[] args) throws InterruptedException {
Client client = new Client();
}
private Channel channel;
public Client() throws InterruptedException {
EventLoopGroup loopGroup = new NioEventLoopGroup();
Bootstrap b = new Bootstrap();
b.group(loopGroup).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new StringDecoder()).
addLast(new StringEncoder()).
addLast(new ClientHandler());
}
});
channel = b.connect("localhost", 9091).sync().channel();
}
public String sendMessage(String msg) {
channel.writeAndFlush(msg);
return ??????????;
}
Run Code Online (Sandbox Code Playgroud)
}
我不知道如何在调用writeAndFlush()之后从服务器检索响应; 我该怎么办? …
我用Google搜索了一下,对我而言,这似乎是可能的.但是当我尝试这样的时候:
class Calc {
def sum(first: Int, second: Int) = {
first + second
}
}
Run Code Online (Sandbox Code Playgroud)
和"测试"类:
class CalcTest {
@Test
def testSum(@Mocked test: Calc) {
new NonStrictExpectations() {{
test.sum(2, 3)
times = 1
result = Int.box(5)
}}
Assert.assertEquals(5, test.sum(2, 3))
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个例外:
java.lang.IllegalAccessError:尝试从com.kvg上的com.kvg.client.CalcTest $$ anon $ 1.(CalcTest.scala:11)类com.kvg.client.CalcTest $$ anon $ 1访问类mockit.Invocations .client.CalcTest.testSum(CalcTest.scala:9)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner. java:77)com.intellij.rt.exe.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)at com.intellij .rt.execution.application.AppMain.main(AppMain.java:120)
JMockit可以与scala一起使用吗?如果它可以,我做错了什么?
我没有使用C++和Win API的经验,很抱歉,如果这个问题没有问题.例如,我有DLL创建一些组件MessageBox.我添加了pragma注释以启用视觉样式并且它不起作用(它应该不是我从这个答案中知道的:在Internet Explorer工具栏上的组合框的Windows 7样式,怎么样?
DLL代码(省略导出等):
#include "stdafx.h"
#include "my-dll.h"
#include <Windows.h>
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
MYDLL_API int fnmydll(void)
{
MessageBox(NULL, L"Message", NULL, 0);
return 42;
}
Run Code Online (Sandbox Code Playgroud)
然后我从我的应用程序调用此dll函数:
#include <iostream>
#include <Windows.h>
#include "my-dll.h"
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
fnmydll();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
而且我的消息框却没有视觉风格.据我所知,我应该在调用我的dll时激活上下文,但MSDN没有示例如何做到这一点.你能不能给我这样的例子或者至少解释一下更多细节?因为我甚BOOL GetCurrentActCtx(_Out_ HANDLE *lphActCtx);至无法理解为什么函数接收指针ACTCTX但具有某种HANDLE类型的签名.
我对winapi和c ++非常陌生,但我需要制作带有细边框和圆角的文本字段.我在winapi参考中找不到这种风格:http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v = vs.85).aspx 既不是在简单的窗口样式也不是在扩展中.我找到的唯一足够的边界是WS_EX_CLIENTEDGE,但它不是我需要的.这是显示当前和期望外观的图片:

那么我该怎样做才能制作这个花哨的边框呢?