我试图从文本文件中读取我的构建版本号,然后将其分配给生成的包名:myRelease-1.1.1.apk,其中内部版本号被手动设置为属性文件version.number = 1.1.1如何通过属性文件中的那个重载pom.xml中设置的$ {version.number}?
编辑:有关该项目的更多详细信息.我使用git提交属性文件,然后Jenkins接管并使用Maven构建.我想最终得到一个构建"myBuild-9.9.9.apk".现在我在extras/version.properties中有"myBuild-1.1.2.apk"
project.version=9.9.9
Run Code Online (Sandbox Code Playgroud)
在pom.xml中
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
.....
<version>1.1.2</version>
</parent>
<groupId>ca.lapresse.android</groupId>
<artifactId>lapresse-hockey-app</artifactId>
<packaging>apk</packaging>
<name>La Presse Hockey - App</name>
<version>1.1.2</version>
Run Code Online (Sandbox Code Playgroud)
......似乎${project.artifactId}从版本号开始<version></version>,它变成了1.1.2.这应该反映在${project.version},我试图从属性文件重载.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/extras/version.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我做错了什么,我根本没做什么?我对Maven的理解非常简陋(我来自Ant背景).
我正在学习Swagger以及如何使用Swagger代码生成REST客户端。我知道如何使用Swagger进行文档编制,也知道如何使用Swagger生成简单的REST Server,但是我不知道如何使用Swagger代码生成简单的REST Client。
例如,我有一个简单的应用程序,它是一个REST Server,并且我想生成REST Client。我可以使用Swagger代码生成代码吗?
REST服务器的控制器:
package com.dgs.spring.springbootswagger.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@RestController
@RequestMapping("/api/v1")
@Api(value = "Employee Management System", description = "Operations pertaining to employee in Employee Management System")
public class EmployeeController {
@Autowired
private EmployeeRepository employeeRepository;
@ApiOperation(value = "View a list of available employees", response = List.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully retrieved list"),
@ApiResponse(code = 401, message = "You are not authorized to view the resource"),
@ApiResponse(code …Run Code Online (Sandbox Code Playgroud) 我对 maven- assembly-plugin 和 maven-jar-plugin 的执行顺序有疑问。我想做的是为pf4j框架(java 插件框架)整理一个 uberjar 文件。为了能够做到这一点,我需要首先使用依赖项组装所有代码,然后将 jar 与清单文件一起打包,该清单文件包含pf4j框架所需的一些特定条目。在问题“更改maven插件执行的顺序”中 ,我在答案中读到绑定到同一阶段的插件的顺序是由pom.xml文件中声明的顺序定义的。现在我有以下 pom.xml 文件:
<?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.assembly.test</groupId>
<artifactId>assembly-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<plugin.id>some-plugin</plugin.id>
<plugin.class>org.assembly.test.Main</plugin.class>
<plugin.version>0.0.1</plugin.version>
<plugin.provider>Developers</plugin.provider>
<plugin.dependencies />
</properties>
<build>
<plugins>
<!-- Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<!-- Assembly Plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filters>
<filter>src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals> …Run Code Online (Sandbox Code Playgroud)