Maven + jarsigner + test classes = error

I have a Maven project that includes some test cases. Today I tried adding the jarsigner plugin and now the tests fail:

java.lang.SecurityException: subscriber information of type "type .AccountType" does not match the subscriber information of other classes in one package

Test classes are in one package to have access to private-private methods, etc. I believe this error occurs because junit test classes are not signed while the classes are being tested.

Does anyone have a suggestion on how to avoid this problem? I had some ideas, but I don’t know how to implement them:

  • The reason for the testing phase for using classes instead of a jar file.
  • Put the test classes in your own jar file and sign it.
+4
source share
1 answer

I ran into this problem today, and the answer, you guessed it, many years ago. This was a fix for me (change the installation step):

        <plugin>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <version>${maven-jarsigner-plugin.version}</version>
            <executions>
                <execution>
                    <id>sign</id>
                    <!-- note: this needs to be bound after integration tests or they will fail re: not signed -->
                    <phase>install</phase>
                    <goals>
                        <goal>sign</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <tsa>http://sha256timestamp.ws.symantec.com/sha256/timestamp</tsa>
                <keystore>${project.basedir}/.conf/Keystore</keystore>
                <alias>Alias</alias>
                <storepass>{1234}</storepass>
            </configuration>
        </plugin>

Banks are still signed up and integration tests are working again.

0
source

All Articles