jcabi / jcabi-manifests

Java library for convenient reading of MANIFEST.MF files available in classpath
https://manifests.jcabi.com
Other
60 stars 22 forks source link

Can not read customize property from webapp #27

Open user20161119 opened 9 years ago

user20161119 commented 9 years ago
java.lang.IllegalArgumentException: Attribute 'higo-build-time' not found in MANIFEST.MF file(s) among 87 other attribute(s): ["Ant-Version", "Archiver-Version", "Bnd-LastModified", "Boot-Class-Path", "Build-Id", "Build-Jdk", "Build-Number", "Build-Time", "Build-Timestamp", "Build-Version", "BuildInfo-Revision", "BuildInfo-Timestamp", "BuildInfo-URL", "Built-By", "Bundle-Activator", "Bundle-ClassPath", "Bundle-Classpath", "Bundle-Description", "Bundle-DocURL", "Bundle-License", "Bundle-ManifestVersion", "Bundle-Name", "Bundle-RequiredExecutionEnvironment", "Bundle-SymbolicName", "Bundle-Vendor", "Bundle-Version", "Can-Redefine-Classes", "Can-Retransform-Classes", "Can-Set-Native-Method-Prefix", "Class-Path", "Created-By", "DSTAMP", "DynamicImport-Package", "Embed-Dependency", "Export-Package", "Extension-Name", "Extension-name", "Fragment-Host", "Hibernate-Version", "Ignore-Package", "Implementation-Build", "Implementation-Build-Date", "Implementation-Title", "Implementation-URL", "Implementation-Vendor", "Implementation-Vendor-Id", "Implementation-Version", "Import-Package", "Include-Resource", "JCabi-Build", "JCabi-Date", "JCabi-Version", "JRebel-Implementation", "Java-Vendor", "Java-Version", "License", "Main-Class", "Major-Version", "Manifest-Version", "Maven-Version", "Name", "Originally-Created-By", "Os-Arch", "Os-Name", "Os-Version", "Package", "Premain-Class", "Private-Package", "Product", "Require-Capability", "Scm-Connection", "Scm-Revision", "Scm-Url", "Specification-Title", "Specification-Vendor", "Specification-Version", "TODAY", "TSTAMP", "Terracotta-Description", "Terracotta-Name", "Terracotta-ProjectStatus", "Time-Zone-Database-Version", "Tool", "Version", "X-Compile-Source-JDK", "X-Compile-Target-JDK", "url"]
    at com.jcabi.manifests.Manifests.read(Manifests.java:274)
    at com.higo.interceptor.UserSessionInterceptor.readBuildtimeStamp(UserSessionInterceptor.java:59)
    at com.baojian.base.interceptor.ClassStart.intercept(ClassStart.java:25)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInv
user20161119 commented 9 years ago

my customize property:higo-build-time and the property is in MANIFEST.MF file:

 Manifest-Version: 1.0
higo-build-time: 20150820064447
Build-Jdk: 1.7.0_79
Built-By: janwen
Created-By: Maven Integration for Eclipse
dmarkov commented 9 years ago

@yegor256 please pay attention to this issue

yegor256 commented 9 years ago

@janwen you need to give more information about your configuration, etc. Also, you may turn on logging for com.jcabi.manifests.* and you will see which MANIFEST.MF files are read.

tblackwe commented 8 years ago

I believe that a MANIFEST.MF that is not in a jar file is not read. So if you don't archive your classes in a webapp the war files MANIFEST.MF is not processed.

I was unable to read web-app MANIFEST.MF until I added the following to my pom

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
               <archiveClasses>true</archiveClasses>
            </configuration>
         </plugin>