对于Maven中心(或任何其他给定的Nexus存储库)上的工件,我想列出所有直接依赖项.
起初,我考虑过只读取pom.xml并从依赖项部分收集所有条目.但我注意到这些条目可能没有版本(由依赖关系管理提供),或者条目可能来自父poms.
我的第二个想法是构建某种人工Maven项目并收集依赖项mvn dependency:tree.这可能会变得复杂.
什么是最直接(但也可靠)的方式?
MavenCentral包含许多工件。其中的一些存在严重漏洞,例如威胁安全性,因此不应使用。
我知道Nexus防火墙可以提供昂贵的服务来分析这些工件。是否有其他方法可以(至少部分)提供针对此类漏洞的保护?
ear:ear如果建立耳朵,目标会自动附加到包装阶段。我想消除它。不幸的是,它没有skip参数。
我怎样才能从一个阶段“分离”一个目标?
我在 Dropwizard 项目中使用 io.github.dropwizard-jobs ( https://github.com/dropwizard-jobs/dropwizard-jobs ) 作为调度程序。
添加了 POM 依赖项
<dependency>
<groupId>io.github.dropwizard-jobs</groupId>
<artifactId>dropwizard-jobs-guice</artifactId>
<version>4.0.0-RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
集成通过 eclipse 在本地运行良好,但是在尝试使用创建包时mvn clean package,出现以下错误。
[WARNING]
Dependency convergence error for com.mchange:c3p0:0.9.5.4 paths to dependency are:
+-project_name:Scheduler:1.0.0.0
+-io.github.dropwizard-jobs:dropwizard-jobs-guice:4.0.0-RELEASE
+-io.github.dropwizard-jobs:dropwizard-jobs-core:4.0.0-RELEASE
+-com.mchange:c3p0:0.9.5.4
and
+-project_name:Scheduler:1.0.0.0
+-io.github.dropwizard-jobs:dropwizard-jobs-guice:4.0.0-RELEASE
+-org.quartz-scheduler:quartz:2.3.1
+-com.mchange:c3p0:0.9.5.3
and
+-project_name:Scheduler:1.0.0.0
+-io.github.dropwizard-jobs:dropwizard-jobs-guice:4.0.0-RELEASE
+-com.mchange:c3p0:0.9.5.4
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
Failed while enforcing releasability the error(s) are [
Dependency convergence error for com.mchange:c3p0:0.9.5.4 paths to dependency are:
+-project_name:Scheduler:1.0.0.0
+-io.github.dropwizard-jobs:dropwizard-jobs-guice:4.0.0-RELEASE
+-io.github.dropwizard-jobs:dropwizard-jobs-core:4.0.0-RELEASE
+-com.mchange:c3p0:0.9.5.4
and
+-project_name:Scheduler:1.0.0.0
+-io.github.dropwizard-jobs:dropwizard-jobs-guice:4.0.0-RELEASE
+-org.quartz-scheduler:quartz:2.3.1
+-com.mchange:c3p0:0.9.5.3
and …Run Code Online (Sandbox Code Playgroud) 目前,我们的 Nexus 会整理 SNAPSHOT,但即使存在发布版本,也始终会留下最后的 SNAPSHOT。原因是:
versions:use-releases只能将现有的SNAPSHOT 版本替换为发布版本。我不喜欢的是快照占用了磁盘上数百 GB 的空间,尽管它们大多毫无用处。
在几年前退役的 Ant 系统中,不存在的“SNAPSHOT”已针对发布版本进行了解决。这解决了上述困境,但在 Maven 中是不可能的。
还有其他好的解决方案吗?
Nexus 和 Artifactory 的解决方案都很受欢迎。
假设您有一个给定长度的边列表(为double).现在您想要找到具有最大长度的边缘.在LINQ中有一个简单的方法吗?
当然,我可以先用Max计算最大值然后进行比较,但首先,这将是两次计算,其次比较双重性是一件坏事.
有什么建议?
我正在使用 jackson 2.8.4 并尝试漂亮地打印(即用缩进很好地格式化)我在名为json.
我试过
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json);
Run Code Online (Sandbox Code Playgroud)
和
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
json = mapper.writeValueAsString(json);
Run Code Online (Sandbox Code Playgroud)
但 JSON 字符串json仍然只是一行。
编辑:
前:
{"artifacts":[{"general":{"name":"jersey-client-2.26.jar","path":"doartifac/spielwiese-group-cache/org/glassfish/jersey/core/jersey-client/2.26/jersey-client-2.26.jar","pkg_type":"Maven","sha256":"3e44b7db8691eb0b2a6751eda888150b9ba1092a5805f11e4727fd4904407a41","component_id":"org.glassfish.jersey.core:jersey-client:2.26"},"issues":[],"licenses":[{"name":"CDDL-1.0","full_name":"Common Development and Distribution License (CDDL)\n 1.0","more_info_url":["http://www.opensource.org/licenses/cddl1.php","https://spdx.org/licenses/CDDL-1.0","https://spdx.org/licenses/CDDL-1.0.html","http://www.opensource.org/licenses/cddl1"],"components":["gav://org.glassfish.jersey.core:jersey-client:2.26"]},{"name":"GPL-2.0","full_name":"The GNU General Public License Version 2","more_info_url":["http://www.opensource.org/licenses/GPL-2.0","http://www.opensource.org/licenses/gpl-2.0.php","https://spdx.org/licenses/GPL-2.0","https://spdx.org/licenses/GPL-2.0.html","http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html"],"components":["gav://org.glassfish.jersey.core:jersey-client:2.26"]}]}]}
Run Code Online (Sandbox Code Playgroud)
后:
"{\"artifacts\":[{\"general\":{\"name\":\"jersey-client-2.26.jar\",\"path\":\"doartifac/spielwiese-group-cache/org/glassfish/jersey/core/jersey-client/2.26/jersey-client-2.26.jar\",\"pkg_type\":\"Maven\",\"sha256\":\"3e44b7db8691eb0b2a6751eda888150b9ba1092a5805f11e4727fd4904407a41\",\"component_id\":\"org.glassfish.jersey.core:jersey-client:2.26\"},\"issues\":[],\"licenses\":[{\"name\":\"CDDL-1.0\",\"full_name\":\"Common Development and Distribution License (CDDL)\\n 1.0\",\"more_info_url\":[\"http://www.opensource.org/licenses/cddl1.php\",\"https://spdx.org/licenses/CDDL-1.0\",\"https://spdx.org/licenses/CDDL-1.0.html\",\"http://www.opensource.org/licenses/cddl1\"],\"components\":[\"gav://org.glassfish.jersey.core:jersey-client:2.26\"]},{\"name\":\"GPL-2.0\",\"full_name\":\"The GNU General Public License Version 2\",\"more_info_url\":[\"http://www.opensource.org/licenses/GPL-2.0\",\"http://www.opensource.org/licenses/gpl-2.0.php\",\"https://spdx.org/licenses/GPL-2.0\",\"https://spdx.org/licenses/GPL-2.0.html\",\"http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html\"],\"components\":[\"gav://org.glassfish.jersey.core:jersey-client:2.26\"]}]}]}"
Run Code Online (Sandbox Code Playgroud) 我正在尝试调用versions:set -DnewVersion=${revision},但没有 ${revision}被替换。
我试图逃避$as \$or $$,但这没有用。
知道如何实现这一目标吗?
考虑以下程序
Date date1 = new Date(-124304227239000L);
Date date2 = new Date(0);
System.out.println(date1 + " vs. " + date2);
Run Code Online (Sandbox Code Playgroud)
结果(至少在我的计算机上使用 Java 8,在另一台计算机上使用 Java 11):
Sun Jan 01 16:59:21 CET 1970 vs. Thu Jan 01 01:00:00 CET 1970
Run Code Online (Sandbox Code Playgroud)
这看起来很奇怪,因为按照文档(https://docs.oracle.com/javase/8/docs/api/java/util/Date.html#Date-long-),作为 Date 参数的负值表示 1970 年之前的日期. 相反,我得到的是星期日而不是星期四,但仍然是 1970 年。
有人可以向我解释一下吗?
在 github actions 中执行以下操作的好方法是什么:
我应该使用原始 git 命令吗?或者 github cli?或者其他动作?
你有什么建议?
java ×8
maven ×6
.net ×1
artifactory ×1
c# ×1
date ×1
dependencies ×1
dropwizard ×1
github ×1
jackson ×1
json ×1
linq ×1
nexus ×1