我想下载一个位于封闭(经过身份验证)的 Nexus 上的 Jar。我想通过 Maven 来做到这一点,与技术无关(例如它可以与 Nexus 或 Artifcatory 一起使用)。
我发现了这个有趣的插件:https://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html,它适用于中央存储库或任何“开放”存储库上的工件。
我的命令是:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -Dartifact=com.test.job:job-template:1.0.0:jar:jar-with-dependencies -Ddest=/tmp/test.jar -DremoteRepositories=http://nexus.test.local/nexus/content/repositories/test-releases/
Run Code Online (Sandbox Code Playgroud)
我收到错误:“未授权,ReasonPhrase:未经授权”。当然,想要得到这件神器,我必须要经过认证。我如何向该命令提供我的凭据?我的 Maven settings.xml 已包含此本地存储库的凭据,但该命令不会读取这些凭据(似乎合乎逻辑)。
谢谢!
我在Java中的String的split函数中遇到了一个意外的特性,这是我的代码:
final String line = "####";
final String[] lineData = line.split("#");
System.out.println("data: " + lineData[0] + " -- " + lineData[1]);
Run Code Online (Sandbox Code Playgroud)
这段代码给了我一个ArrayIndexOutOfBoundsException,而我希望它打印""和""(两个空字符串),或者可能是null和null(两个空字符串).
如果我改变我的代码
final String line = " # # # #";
final String[] lineData = line.split("#");
System.out.println("data: " + lineData[0] + " -- " + lineData[1]);
Run Code Online (Sandbox Code Playgroud)
然后它打印""和""(预期的行为).
如何让我的第一个代码不抛出异常,并给我一个空字符串数组?
谢谢
我是Vaadin的新手,并试图了解它是否适合我对webapp项目迁移的需求.实际上我已经在一个简单的目标上浪费了我的时间:拥有固定页眉和页脚的布局,以及中间的可滚动内容.我用我想要的东西做了一个非常基本的小提琴: jsfiddle
这是我提出的主要Vaadin课程:
public class MyVaadinUI extends UI {
// attributes
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "testvaadin.aep.com.AppWidgetSet")
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
buildMainLayout();
}
private void buildMainLayout() {
final VerticalLayout mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
//HEADER
final VerticalLayout headerLayout = new VerticalLayout();
final Resource res = new ThemeResource("img/logo.png");
final Image image = new Image(null, res);
headerLayout.addComponent(image);
//CONTENT
final VerticalLayout contentLayout = new …Run Code Online (Sandbox Code Playgroud)