21

我正在使用 appengine-maven-plugin 构建我的 Java Google App Engine 项目。

我在 WEB-INF 子文件夹中包含 .p12 证书

当我构建我的应用程序时,证书的文件大小增加了几 KB。这使其无效。我也看到 .jks 证书也发生了同样的情况。

我已经验证了证书预构建的有效性,并使用相同的方法来确认构建后证书的无效性。

谁能告诉我为什么文件大小会发生变化以及为什么不简单地将其复制到 WAR 中?

谢谢你的帮助。

4

3 回答 3

32

另一种解决方案是通过添加以下配置来禁用整个项目中 .p12 文件的过滤:

<build>
  ...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-resources-plugin</artifactId>                
      <configuration>
        <nonFilteredFileExtensions>
          <nonFilteredFileExtension>p12</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
      </configuration>
    </plugin>
  </plugins>
</build>
于 2014-06-18T09:43:49.227 回答
9

似乎 Maven 正在对我的证书文件应用过滤

http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

解决方案是禁用它

<resource>
    <directory>${basedir}/src/main/webapp/certs</directory>
    <filtering>false</filtering>
    <targetPath>WEB-INF/classes</targetPath>
</resource>

这允许正确读取证书并解决 JavaPNS 中的以下异常

Validating keystore reference: VALID  (keystore was found)
Verifying keystore content: javapns.communication.exceptions.KeystoreException:
Keystore exception: DerInputStream.getLength(): lengthTag=111, too big. at javapns.communication.KeystoreManager.wrapKeystoreException(KeystoreManager.java:178)
于 2013-10-21T18:58:29.137 回答
0

我通过将“.p12”文件向上移动一个目录解决了这个问题。因此,我没有将其保存在 WEB-INF 中,而是将其移至“webapp”目录。那里没有过滤。

于 2015-04-15T18:01:32.427 回答