Aym*_*tel 4 java pom.xml maven
我在Maven构建期间遇到此错误。
无法在项目dl4j上执行目标org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade(默认)-示例:创建阴影jar时出错:无效的LOC标头(错误的签名)-> [帮助1] [错误]
这是我的pom.xml文件。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>${shadedClassifier}</shadedClassifierName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>org/datanucleus/**</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我试图多次删除jar文件,但似乎无法正常工作。
小智 5
我已经面临这个问题很长时间了
所以我决定自动识别和移除损坏的罐子
这是我为此目的创建的 util 类:
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.jar.JarFile;
public class MavenFix {
public static void main(String[] args) throws IOException {
Files.walk(Paths.get("C:/data/.m2/repository"))
.filter(file -> file.toString().endsWith("jar"))
.forEach(path -> {
try {
System.out.print(".");
new JarFile(path.toString(), true).getManifest();
} catch (Exception e) {
System.out.println();
System.out.println(path + " - " + e.getMessage());
try {
cleanAndDeleteDirectory(path.getParent().toFile());
} catch (IOException e1) {
System.err.println(e1.getMessage());
}
}
});
}
public static void cleanAndDeleteDirectory(File dir) throws IOException {
File[] files = dir.listFiles();
if (files != null && files.length > 0) {
for (File aFile : files) {
Files.delete(aFile.toPath());
}
}
Files.delete(dir.toPath());
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10992 次 |
| 最近记录: |