rpm jar文件压缩,无插件

lbsnaicq  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(389)

我正在尝试在RHEL7上创建一个简单的rpm包。。但我不能完成它,因为它给了我错误。。我已经遵循了这个线程和其中提到的线程。
rpmbuild更改压缩格式
我想用jar文件和其他脚本在同一个目录中创建一个rpm。这是规范文件内容:

Summary: Net Demo
%define version 1.0
License: NetCOP
Group: MDA Data Team
Name: NetCOP
Prefix: /usr/local/bin
Provides: netcop.jar
Release: 1
URL: HTTP://127.0.0.1:8181/index
Version: %{version}
BuildRoot: %{builddir}/%{name}-root
%description
NetCOP demo provides a demo of NetCOP at the provided URL

%prep
%build
%install
pwd
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin/NetCOPDemo
cd $RPM_BUILD_ROOT/usr/local/bin/NetCOPDemo
cp -R ~rpmmanager/rpmbuild/builds/NetCOP_Demo_Dashboard .
%clean
%files
%defattr(-,root,root)
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/StartNetCOP.vbs
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/StopNetCOP.vbs
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/scripts/a.bat
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/scripts/b.bat
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/scripts/run.sh
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/urltotest.txt
/usr/local/bin/NetCOPDemo/NetCOP_Demo_Dashboard/netcop.jar
```

这是宏文件:
%_topdir %(echo $HOME)/rpmbuild

%_tmppath %(echo $HOME)/rpmbuild/tmp

%_smp_mflags %( \
    [ -z "$RPM_BUILD_NCPUS" ] \\\
        && RPM_BUILD_NCPUS="`/usr/bin/nproc 2>/dev/null || \\\
    if [ "$RMP_BUILD_NCPUS" -gt 16 ]; then \\\
        echo "-j16"; \\\
    elif [ "$RPM_BUILD_NCPUS" -gt 3 ]; then \\\
        echo "-j$RPM_BUILD_NCPUS"; \\\
    else \\\
        echo "-j3"; \\\
    fi )

%_arch_install_post \
    [ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \
    case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \
    /usr/lib/rpm/check-buildroot
不管我做了什么尝试,我总是在安装后运行netcop.jar文件时出错。误差如下:
Exception in thread "main" java.lang.IllegalState Exception: Failed to get nested archive for entry BOOT-INF/lib/HdrHistogram-2.1.12.jar
    at org.springframework.boot.loader.archive.JarFileArchive.getNestedArchive...
Caused by: java.io.IOException: Unable to open nested jar file 'BOOT-INF/lib/HdrHistogram-2.1.12.jar'
    at org.springframework.boot.loader.archive.JarFile.getNestedJarFile(JarFile.java:288)..
Caused by: java.lang.IllegalStateException: Unable to open neseted entry 'BOOT-INF/lib/HdrHistogram-2.1.12.jar' It has been compressed and nested jar files must be stored without compression. Please check mechanism used to create your executable jar file
    at org.springframework.boot.loader.jar.JarFile.createJarFileFromFileEntry(JarFile.java:314)...
在rpm中打包jar文件而不进行压缩的最佳方法是什么?我在上面列出的帖子中放置了推荐的代码,但是得到了相同的错误。
提前谢谢你的帮助。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题