jcabi-github
jcabi-github copied to clipboard
Attribute 'JCabi-Version' not found in MANIFEST.MF strikes again
It's not just that this GitHub library adds 5MB of dependencies. It also throws this error when ran from .jar
:
Caused by: java.lang.IllegalArgumentException: Attribute 'JCabi-Version' not found in MANIFEST.MF file(s) among 6 other attribute(s)
This doesn't happen when I run the library using the Run button in Netbeans. It's nice that you fixed the typo in the error message, but the error is still here.
I can't resist asking a question: Why the hell is compile-time stuff checked at run-time? If that was t compile time - as sane people use to arrange it - I would find about this error much sooner. Instead it lurked until I tried to make a release, which I now cannot do.
@yegor256 please do something about it, see par.21
@Darker which JAR are you using? are you packaging using Maven?
I tried several versions which are available from the maven repository. I am using Netbeans Maven project to build my JAR. I do not really know what's going on within the build process, I just created it through GUI.
I will try to commit and push the project now so that you can reproduce the issue. It might take time though, because I already removed this library from the project and will now have to add it again.
I just started using this API, but unfortunately I am running into this issue too after running 'mvn install' and trying to run the jar w/ dependencies produced. Thanks for any help!
I am using the maven-assembly-plugin to package.
I fixed this issue by using another library.
@Darker which one?
same issue here with 0.23
with 0.27 as well, both from maven central ( I think, could be sonatype as well )
moved to this one: http://github-api.kohsuke.org/. Be sure to include the jenkins maven resolver. In SBT: resolvers += "repo.jenkins-ci.org" at "http://repo.jenkins-ci.org/public",
@leemartie @Darker @cvogt I solved the issue by adding:
<configuration>
...
<archive>
...
<manifestEntries>
<JCabi-Version>0.28</JCabi-Version>
<JCabi-Date>2016-06-05 07:16</JCabi-Date>
<JCabi-Build>cce246f</JCabi-Build>
</manifestEntries>
...
</archive>
</configuration>
in maven-assembly-plugin
. It can also be added in the jar
and ejb
plugins (and war
, I think)`
Basically, it hardcodes the required attributes into the Manifest.mf of your project. These attributes are only used to build the User-Agent
HTTP header which is sent with every request made to Github, so there isn't any problem if you just hardcode them, it won't break any logic.
There is an open issue to get rid of this manifest.mf mechanism: #1246
FYI for gradle this can be fixed with:
jar {
manifest {
attributes("JCabi-Version": "0.28",
"JCabi-Date": "2016-06-05 07:16",
"JCabi-Build": "cce246f")
}
}
Seeing this still with 0.33.1
, used with @Grape
in a Jenkins Groovy file.
Usage:
@Grab(group='com.jcabi', module='jcabi-github', version='0.33.1')
Error:
java.lang.IllegalArgumentException: Attribute 'JCabi-Version' not found in MANIFEST.MF file(s) among 72 other attribute(s): ["Ant-Version", "Application-Name", "Archiver-Version", "Bnd-LastModified", "Build-Jdk", "Built-By", "Built-Date", "Bundle-ActivationPolicy", "Bundle-Category", "Bundle-ClassPath", "Bundle-Copyright", "Bundle-Description", "Bundle-DocURL", "Bundle-License", "Bundle-ManifestVersion", "Bundle-Name", "Bundle-NativeCode", "Bundle-RequiredExecutionEnvironment", "Bundle-SymbolicName", "Bundle-Vendor", "Bundle-Version", "Class-Path", "Codebase", "Created-By", "DynamicImport-Package", "Eclipse-BuddyPolicy", "Eclipse-ExtensibleAPI", "Export-Package", "Extension-Name", "Fragment-Host", "Group-Id", "Hudson-Version", "Ignore-Package", "Implementation-Build", "Implementation-Title", "Implementation-URL", "Implementation-Vendor", "Implementation-Vendor-Id", "Implementation-Version", "Import-Package", "Include-Resource", "Jenkins-Version", "Long-Name", "Main-Class", "Main-class", "Manifest-Version", "Originally-Created-By", "Package", "Permissions", "Plugin-Developers", "Plugin-Version", "Private-Package", "Probe-Provider-XML-File-Names", "Require-Bundle", "Require-Capability", "Short-Name", "Specification-Title", "Specification-Vendor", "Specification-Version", "Spring-Version", "Support-Dynamic-Loading", "Tool", "Trusted-Library", "Url", "Version", "X-Build-Os", "X-Build-Time", "X-Builder", "X-Compile-Source", "X-Compile-Source-JDK", "X-Compile-Target", "X-Compile-Target-JDK"]
at com.jcabi.manifests.Manifests.read(Manifests.java:274)
at com.jcabi.github.RtGithub.<clinit>(RtGithub.java:83)
Caused: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at cloud.run(cloud.groovy:54)
at cloud$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at generate$run.call(Unknown Source)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScript(AbstractDslScriptLoader.groovy:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScriptEngine(AbstractDslScriptLoader.groovy:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader$_runScripts_closure1.doCall(AbstractDslScriptLoader.groovy:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2040)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2025)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2078)
at org.codehaus.groovy.runtime.dgm$164.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at javaposse.jobdsl.dsl.AbstractDslScriptLoader.runScripts(AbstractDslScriptLoader.groovy:46)
at javaposse.jobdsl.plugin.ExecuteDslScripts.perform(ExecuteDslScripts.java:323)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1724)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)