项目pom.xml中有一个liquibase-maven-plugin <3.6.2>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<changeLogFile>src/test/resources/liquibase/changelog.xml</changeLogFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
文档说:
记录:
控制执行时 Liquibase 的日志记录级别。该值可以是“调试”、“信息”、“警告”、“严重”或“关闭”。该值不区分大小写。类型:java.lang.String 必需:无 表达式:${liquibase.logging} 默认值:INFO
我不明白如何应用它。
我有一个Spring Boot
基础应用程序,当我使用name运行时java
,它会生成一个工件。JAR
mvn clean install
my-nexus-demo-0.0.1-SNAPSHOT.jar
但是当我这样做时,mvn clean deploy
我看到部署在我的本地文件系统中(将来my-nexus-demo-0.0.1-20190806.161150-1.jar
将使用)。Nexus
不知道为什么当我使用mvn clean deploy
命令时它会附加日期时间和增量 # 作为后缀。
我已经<finalName>${project.artifactId}</finalName>
在我的文章中提到过pom
并且也指定了<uniqueVersion>false</uniqueVersion>
。
我这里有几个问题:
.m2
仓库和SNAPSHOT
仓库之间拥有一致的工件名称RELEASE
?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>my-nexus-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>my-nexus-demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId> …
Run Code Online (Sandbox Code Playgroud) 大家好,我正在尝试为我的 Spring Boot 项目添加 Apache commons-csv 版本 1.8 依赖项,但出现以下错误。未找到依赖项“org.apache.commons:commons-csv:1.8”。另外,我正在使用 Java 14。为了供您参考,我还粘贴了我的 pom.xml。
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我找到了这个很好的食谱,并希望用它在我们的存储库中部署一些第三方文件
命令行上的调用是
mvn -P deploy-libs
Run Code Online (Sandbox Code Playgroud)
如果我为一个文件执行此操作,它将完全按预期工作
<profiles>
<profile>
<id>deploy-libs</id>
<build>
<defaultGoal>deploy:deploy-file</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>openscada-external</repositoryId>
<url>${openscada.distrib.repository}</url>
<file>../openscada_opc_dcom/lib/j-interop.jar</file>
<pomFile>../openscada_opc_dcom/lib/j-interop.pom</pomFile>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
如果我使用具有多个执行的执行块,则它不起作用.这是一个错误,还是这个预期的行为?
<profiles>
<profile>
<id>deploy-libs</id>
<build>
<defaultGoal>deploy:deploy-file</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
<configuration>
<repositoryId>openscada-external</repositoryId>
<url>${openscada.distrib.repository}</url>
</configuration>
<executions>
<execution>
<id>j-interop</id>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>../openscada_opc_dcom/lib/j-interop.jar</file>
<pomFile>../openscada_opc_dcom/lib/j-interop.pom</pomFile>
</configuration>
</execution>
<execution>
<id>j-interopdeps</id>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>../openscada_opc_dcom/lib/j-interopdeps.jar</file>
<pomFile>../openscada_opc_dcom/lib/j-interopdeps.pom</pomFile>
</configuration>
</execution>
<execution>
<id>jcifs</id>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>../openscada_opc_dcom/lib/jcifs-1.2.9.jar</file>
<pomFile>../openscada_opc_dcom/lib/jcifs-1.2.9.pom</pomFile>
</configuration>
</execution> …
Run Code Online (Sandbox Code Playgroud) 与此问题类似,我不能进行glassfish部署,因为目前澳大利亚的一些服务器已经关闭.我已经在本地缓存了几个月的工件.
如何告诉maven不要尝试更新插件(及其依赖项)?我尝试将以下内容添加到我的pom中,但它没有帮助:
<pluginRepositories>
<pluginRepository>
<id>ocean</id>
<url>http://maven.ocean.net.au</url>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
Run Code Online (Sandbox Code Playgroud)
我也尝试过命令行开关.还有-npu
,这似乎并没有帮助与Maven 2.2.1.在Maven 3上,文档说"无效,只能保持向后兼容性",所以我对这个没有太大的希望.
我们很快就会转向Nexus,但应该有一种简单的方法告诉maven不要尝试插件更新.
我想生成我的报告所以我用过maven-surefire-plugin
.
这是我的pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>test-reports</id>
<phase>install</phase>
<configuration>
<tasks>
<junitreport todir="./reports">
<fileset dir="./reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./report/html"/>
</junitreport>
</tasks>
</configuration>
<goals>
<goal>test </goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是当我运行maven测试时,我收到了这个错误:
Tests run: 6, Failures: 2, Errors: 2, Skipped: 0
[INFO] --------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------------------------------------------------
[INFO] Total time: 10.403s
[INFO] Finished at: Wed Oct 12 08:35:10 CEST 2011
[INFO] Final Memory: 17M/126M
[INFO] --------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.10:test (default-test) on …
Run Code Online (Sandbox Code Playgroud) 我配置了一些插件目标,在我的构建生命周期的某些阶段(maven android应用程序)中执行.但我认为我在配置插件时遇到了一个错误,并希望确保它们真正被调用.我发现这个命令将打印所有生命周期阶段和目标:mvn help:describe -Dcmd=install
但它没有显示我配置的目标.因此,我有两个问题:
mvn help:describe -Dcmd=install
命令是否显示我在<build>/<plugins>/<plugin>/<executions>/<execution>
pom标签内配置的目标?
如何确保在构建生命周期中调用阶段和阶段期间调用的目标?
更新 我正在尝试配置maven-android-plugin并希望在包阶段执行zipalign目标
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>8</platform>
</sdk>
<emulator>
<avd>2.3.3_API-10</avd>
</emulator>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<assetsDirectory>${project.build.directory}/filtered-assets</assetsDirectory>
<androidManifestFile>${project.build.directory}/filtered-manifest/AndroidManifest.xml</androidManifestFile>
<zipalign>
<skip>false</skip>
<verbose>${build.verbosity}</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${build.version.name}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-${build.version.name}-aligned.apk</outputApk>
</zipalign>
</configuration>
<executions>
<execution>
<id>zipalign</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我正在考虑使用模板引擎来生成 web.xml 和其他东西。
有没有办法在maven install 命令之前运行 java 文件或脚本?或者在战争发生之前。
我不确定阶段应该是什么,但基本上在其他人查看 web.xml 之前,我可以触摸它来创建一个新的有效阶段。
task writeNewPom {
pom {
project {
/*
build {
plugins {
plugin {
groupId 'GROUP_ID'
artifactId 'maven-ipcentral-plugin'
version '4.7'
executions {}
configuration {
url "http://CENTRAL_REPORTING_SERVER"
logfileprefix "test"
ipcProject = true
businessUnit "FOUR_DIGIT_CODE"
componentEditorsGrouper "ccp-dev"
assetEditorsGrouper "ccp-dev"
username "USERNAME"
}
}
}
}
*/
pluginRepositories {
pluginRepository {
id 'ipcentral-snapshots'
name 'IPCentral Snapshot Repository'
url 'http://PLUGIN_SOURCE/'
snapshots {
enabled = false
}
releases {
enabled = true
}
}
}
profiles {
profile {
id 'inject-cec-credentials'
activation {
activeByDefault = …
Run Code Online (Sandbox Code Playgroud) 我有一个Maven pom文件可以从如下结构构建:
package1
--1.java
--2.java
--packageMetaInfo.xml
package2
--21.java
--22.java
--packageMetaInfo.xml
当我执行Maven编译时,xml文件不会进入目标。
maven-compiler-plugin 3.5.1-除非我通过排除xml <exclusions>
,否则将收到以下错误消息:“致命错误编译:所有编译单元必须是SOURCE类型->” maven-compiler-plugin 2.0.1-编译但跳过了XML文件
有没有办法让我的jar中包含xml。结构将是
x.jar
package1
--1.class
--2.class
--packageMetaInfo.xml
package2
--21.class
--22.class
--packageMetaInfo.xml
*我知道在源文件中包含xml可能不是maven的标准,但是我正在开发特定产品,因此需要在输入和输出中都维护此结构。
<?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>
<groupId>com.incent</groupId>
<artifactId>Release-4.3.0.1.0.0001</artifactId>
<name>AAA Custom code</name>
<version>2.4.0.1</version>
<properties>
<ormb.cmccb.path>./Active_Repository/CMCCB</ormb.cmccb.path>
<ormb.customcode.path>${ormb.cmccb.path}/data</ormb.customcode.path>
<ormb.release.name>AAA-4.3.0.1.0.0001</ormb.release.name>
<ormb.target.path>./target</ormb.target.path>
<ormb.output.path>Release-${ormb.release.name}/Application/${ormb.release.name}/CMCCB</ormb.output.path>
<ormb.serverfile.output.relpath>./target/server</ormb.serverfile.output.relpath>
<build.number>SNAPSHOT</build.number>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>icu4j</groupId>
<artifactId>icu4j</artifactId>
<version>49.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version> …
Run Code Online (Sandbox Code Playgroud) 我是第一次使用这个工具,我无法正确构建项目。
当我尝试生命周期命令时,它通过干净的验证和编译成功构建。但是当我尝试 mvn test 时,它给了我这个错误:
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 4.410 s
[INFO] Finished at: 2018-05-25T11:33:07+02:00
[INFO] ---------------------------------------------------------------------
---
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.20.1:test (default-test) on project gdp: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
:NullPointerException
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more …
Run Code Online (Sandbox Code Playgroud) 按照此处的建议,这些建议是如何使用 Spring Boot 的 maven 插件将 SSL 证书传递到构建映像中。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<bindings>
<binding>${basedir}/bindings/certificates:/platform/bindings/ca-certificates</binding>
</bindings>
</image>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
project
|-bindings
|-certificates
|-type
|-certificate.crt
Run Code Online (Sandbox Code Playgroud)
$ cat bindings/certificates/type
ca-certificates
Run Code Online (Sandbox Code Playgroud)
$ ./mvnw spring-boot:build-image
...
...
...
[INFO] > Running creator
[INFO] [creator] ===> ANALYZING
[INFO] [creator] Restoring data for SBOM from previous image
[INFO] [creator] ===> DETECTING
[INFO] [creator] ======== Output: paketo-buildpacks/git@1.0.1 ========
[INFO] [creator] failed to load bindings from '/platform/bindings': failed to read binding …
Run Code Online (Sandbox Code Playgroud) 我使用带有spring和hibernate的tapestry 5,我尝试构建我的应用程序抛出我的这个异常??? !!! ???什么是问题,任何建议都会是这样的relif ????
[WARNING] Some problems were encountered while building the effective model for com.fit:rent-a-car:war:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 194, column 18
[WARNING] 'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 235, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
.....
.....
[ERROR] ioc.Registry No service implements …
Run Code Online (Sandbox Code Playgroud) maven-plugin ×13
maven ×9
java ×7
maven-3 ×3
spring-boot ×3
build ×2
spring ×2
android ×1
gradle ×1
jakarta-ee ×1
junit ×1
liquibase ×1
maven-2 ×1
paketo ×1
pom.xml ×1
spring-mvc ×1
tapestry ×1