gpt4 book ai didi

java - maven pom 到 gradle - 程序集插件失败

转载 作者:太空宇宙 更新时间:2023-11-04 12:18:48 24 4
gpt4 key购买 nike

我目前正在拥有 JAVA Maven 项目并尝试将其迁移到 Gradle。我发出以下命令来转换它,

gradle init

请在下面找到pom.xml,我的项目的描述符xml文件以及生成的build.gradle文件,

pom.xml

<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>

<artifactId>ProjectA</artifactId>
<packaging>jar</packaging>

<name>ProjectA</name>


<dependencies>
<dependency>
<groupId>org.jpos</groupId>
<artifactId>jpos</artifactId>
<version>113</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/non-distributable-lib/jpos113.jar</systemPath>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<archive>
<manifest>
<mainClass>com.test.jpos.Main</mainClass>
</manifest>
</archive>
<descriptor>src/main/assembly/assemble_POSMClient_JPOS_Bridge.xml</descriptor>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>com.test</groupId>
<artifactId>ProjectRoot</artifactId>
<version>5.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

构建.gradle:

description = 'ProjectA'
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile files('src/main/non-distributable-lib/jpos113.jar')
}

assemble_POSMClient_JPOS_Bridge.xml:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assemble_pos</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.basedir}/../POSMClient-Common/src/main/lib/Packaged-Web-Components</directory>
<outputDirectory>Packaged-Web-Components</outputDirectory>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>www.zip</exclude>
<exclude>*.uncompressed.js</exclude>
<exclude>js/lib/cometd/*</exclude>
<exclude>.gitmodules</exclude>
<exclude>README.md</exclude>
<exclude>package.sh</exclude>
<exclude>updateDojo.sh</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/../POSMClient-Common/src/main/native</directory>
<outputDirectory>Packaged-Web-Components/</outputDirectory>
<includes>
<include>*</include>
</includes>
</fileSet>
</fileSets>

注意:当我进行清理时,没有出现任何异常并且成功,但无法生成程序集 jar 文件。

gradle clean

无法在 build.gradle 文件中生成程序集插件部分。如果我遗漏了什么,请告诉我。

最佳答案

没有类似的方式来使用 Maven 和 gradle。仅仅运行 gradle init 并不能帮助解决大部分 pom 结构。

Gradle 有类似的分发插件。

下面的链接有更多详细信息,介绍如何在 build.gradle 文件中编写代码块来实现汇编和分发。

https://docs.gradle.org/current/userguide/distribution_plugin.html

关于java - maven pom 到 gradle - 程序集插件失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39078420/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com