如何更新子模块的版本?有很多类似这样的Stackoverflow问题,但是我找不到适合这种情况的问题...如果这是重复的话,我会很高兴.
考虑以下项目.
parent
--mod1
--mod2
Run Code Online (Sandbox Code Playgroud)
在开发阶段开始时,我需要将父模块和模块更新为相同的版本.如果父版本和模块的版本在整个版本中保持不变,那么我将只省略<version>模块中的标记并执行versions:set -DnewVersion=1.1.1以启动开发周期.但事实证明,模块不会以相同的版本结束循环.由于错误和修复只能实现那些带有错误的模块,因此会更新.例如,parent和mod2可能是版本1.1.1-RC1,但mod1可能是1.1.1-RC2.
因此,我需要:
1)<version>在模块中包含一个标签,以独立跟踪每个模块版本.
2)如果mod2需要mod1作为依赖项,我需要确保mod2引用最新版本的mod1.
这导致以下两个问题.
1)在循环开始时如何在一个maven命令中将父模块和模块设置为相同的版本?我试过了version:set -DnewVersion=1.1.1,但这只是更新了所有POM的父版本,而不是模块的版本.我也尝试了-N versions:update-child-modules,但我认为我使用它是错误的,因为它什么也没做,只是跳过了所有模块.
2)这有点难,与上面第2项相符.如何一步更新mod1的版本和mod2对mod1版本的引用?我知道如何分两步完成:
父母pom:
<properties>
<!-- update this manually if mod1's version no longer matches parent -->
<mod1.version>${project.version}</mod1.version>
</properties>
Run Code Online (Sandbox Code Playgroud)
mod2 pom:
<dependency>
<groupId>com.xxx</groupId>
<artifactId>mod1</artifactId>
<version>${mod1.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
当mod1碰到1.1.1-RC2时,我更新父POM和mod1 POM以反映这一点.这是两个步骤.无论如何把它变成一步?
我的例子虽小,但在现实生活中有许多模块可以节省大量时间,而且我很好奇.
在我们的setting.xml文件中,我们有以下内容:
<servers>
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
是否可以通过环境变量而不是settings.xml传递这些设置(或它们的等效设置)?
我注意到有两个用于Java的bouncycastle提供程序库; bcprov和bcprov-ext.他们有什么不同?如何选择使用哪个?
我们使用Swagger和Spring Fox版本2.5.0,下面是POM条目.当我们创建一个使用参数Map的Spring MVC控制器(参见下面的示例)时,Swagger-UI页面无法正确生成.有问题的控制器没有出现在Swagger-UI页面上,也没有出现在它之后的控制器(按字母顺序排列).
@RequestMapping(value = "/resource/", method = RequestMethod.GET, produces = {"application/json"})
public void get(@RequestParam MultiValueMap<String, String> params) {
//code
}
Run Code Online (Sandbox Code Playgroud)
删除params Map后,一切都很好.知道问题是什么或如何绕过它?
以下是可能有用或可能没用的更多信息.
依赖:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
Swagger配置:
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket api() {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(PathSelectors.any())
.build();
docket.ignoredParameterTypes(Principal.class);
return docket;
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("some app")
.description("some description")
.build();
}
}
Run Code Online (Sandbox Code Playgroud) 通过阅读 log4j 2文档,如果适当的配置文件在类路径中,则预计将加载配置。但我需要确定配置文件已正确处理。有没有一种方法可以验证我希望加载的配置文件是否确实找到并成功加载?
我正在编写将被其他开发人员使用的代码,可能是我们正在编写的库中不可或缺的 log4j 2 没有正确配置,因为文件不在类路径中或配置错误。如果 log4j 2 配置不正确,我必须停止对我们库的进一步处理,它必须吐出重大错误,并且必须对此进行大处理。我不能让代码继续。所以最重要的是,我需要知道 log4j 2 正确处理了预期的配置文件。
另外,我更喜欢使用 log4j 2 API 而不是 Core 库,但如果 Core 是唯一的方法,那就这样吧。
我正在尝试使用 JDK 17 和 Maven 3.8.4 编译现有的 Spring Boot 项目,但不断收到此错误。
无法使字段私有 com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors com.sun.tools.javac.processing.JavacProcessingEnvironment.discoveredProcs 可访问:模块 jdk.compiler 不会“打开 com.sun.tools.javac.processing “到未命名模块@521e3470
旧版本的 Maven(例如 3.6)也会出现此问题。java.versionJDK 16 也会发生这种情况。通过、maven.compiler.source、 和在 pom.xml 中配置哪个版本的 Java 并不重要maven.compiler.target。mvn -v命令中仅显示用于进行编译的 JDK 版本...。
该项目使用 JDK 15 可以正常编译。编译开始时,错误立即发生,就在说明正在编译多少个类的 INFO 消息之后。我的 Windows 笔记本电脑和 Ubuntu CI 服务器上都会发生这种情况。
有什么想法吗?
编辑:添加更多 POM 文件。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>15</java.version>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
<spring-cloud.version>2020.0.4</spring-cloud.version>
<ch.qos.logback.version>1.2.3</ch.qos.logback.version>
</properties>
Run Code Online (Sandbox Code Playgroud)
编辑:我也使用龙目岛
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version> …Run Code Online (Sandbox Code Playgroud) 我们正在使用Jersey Client 2.21。我注意到,当我们将花括号(也称为花括号)作为参数值时,则无法正确编码。不仅如此,大括号内的所有内容均未得到编码。对于常规括号或我测试过的其他不安全字符,情况并非如此。
请参见下面的示例。在此示例中,我输入三个参数。仅带有空格的控制参数。一种带花括号,另一种带方括号。
public static void testJerseyEncoding() {
Client client = ClientBuilder.newClient();
String url = "http://foo.com/path";
Map<String, String> map = new HashMap<>();
map.put("paramWithCurly", " {with a space}");
map.put("paramWithOutCurly", "with a space");
map.put("paramWithBracket", "[with a space]");
WebTarget target = client.target(url);
for (Map.Entry<String, String> entry : map.entrySet()) {
target = target.queryParam(entry.getKey(), entry.getValue());
}
System.out.println(target.toString());
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
JerseyWebTarget { http://foo.com/path?paramWithBracket=%5Bwith+a+space%5D¶mWithOutCurly=with+a+space¶mWithCurly=+{with a space} }
Run Code Online (Sandbox Code Playgroud)
泽西客户有问题吗?还是我错过了什么?花括号应已编码为“%7B”。
Spring允许拦截许多产品的消息,比如RestTemplate和SpringMVC.是否可以拦截Spring Cloud Stream消息?对于传入和传出消息.
我用ojdb7.jar换了tomcat/lib中的ojdb6.jar文件.打开Tomcat,尝试使用它时出现以下错误...
Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的连接池配置....
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" type="javax.sql.DataSource"
maxActive="25" maxIdle="25" maxWait="2000"
name="jdbc/getcontacts"
timeBetweenEvictionRunsMillis="1000"
minEvictableIdleTimeMillis="30000"
removeAbandoned="true"
removeAbandonedTimeout="30000"
logAbandoned="true"
username="xxxx" password="xxxxx"
validationQuery="Select 1 from dual" connectionProperties="defaultRowPrefetch=10000"
url="jdbcracle:thin:@//xxxxx.net/xxxxx" />
Run Code Online (Sandbox Code Playgroud)
知道是什么原因引起的吗?我们正在使用Oracle数据库11g.
/usr/jdk7/bin/java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.当我把ojdb6.jar文件放回去并删除ojdb7.jar文件时,一切正常.
默认情况下,Spring Sleuth 只向 Zipkin 发送 10% 的请求。通过设置,spring.sleuth.sampler.percentage您可以增加百分比。不幸的是,无论我将其设置为什么值,它都停留在 10%。我试过 1.0、0.5、1、100。
输出来自 /env
"spring.sleuth.sampler.percentage": {
"value": 1,
"origin": "class path resource [application.yml]:77:19"
}
Run Code Online (Sandbox Code Playgroud)
不管价值如何,当我提出多个请求时,只有 10% 的请求到达 Zipkin。
我们使用的是 Spring Cloud 的 Finchley.M8 版本和 Spring Boot 的 2.0.0.RELEASE 版本。
下面是相关的 POM 设置。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.M8</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这可能是一个错误吗?
java ×7
maven ×3
spring-cloud ×2
aws-cli ×1
aws-ecs ×1
aws-elb ×1
bouncycastle ×1
jersey-2.0 ×1
log4j2 ×1
lombok ×1
module ×1
multi-module ×1
ojdbc ×1
openjdk-17 ×1
spring-mvc ×1
swagger-2.0 ×1
swagger-ui ×1
tomcat ×1
url-encoding ×1
urlencode ×1
zipkin ×1