Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase.jar does not have MANIFEST.MF as the 2nd entry in the archive #2648

Closed
nvoxland opened this issue Mar 16, 2022 · 5 comments · Fixed by #2666
Closed

Liquibase.jar does not have MANIFEST.MF as the 2nd entry in the archive #2648

nvoxland opened this issue Mar 16, 2022 · 5 comments · Fixed by #2666
Labels
Milestone

Comments

@nvoxland
Copy link
Contributor

nvoxland commented Mar 16, 2022

Description

Some tools expect the MANIFEST.MF file to be physically the 2nd entry in the jar archive. It's java.util.jar.JarInputStream that requires this: See https://bugs.openjdk.java.net/browse/JDK-8215788

Because we have it in the wrong spot, many tools will not correctly use the liquibase.jar file.

See also:

Repro Steps

└➤ jar -tf bundles/osgi/modules/liquibase-core-4.8.0.jar | grep META-INF
META-INF/
META-INF/services/
META-INF/LICENSE.txt
META-INF/NOTICE.txt
META-INF/NOTICE
META-INF/services/liquibase.database.DatabaseConnection
META-INF/services/liquibase.precondition.Precondition
META-INF/services/liquibase.serializer.SnapshotSerializer
META-INF/services/liquibase.configuration.AutoloadedConfigurations
META-INF/services/liquibase.diff.DiffGenerator
META-INF/services/liquibase.lockservice.LockService
META-INF/services/liquibase.license.LicenseService
META-INF/services/liquibase.changelog.ChangeLogHistoryService
META-INF/services/liquibase.datatype.LiquibaseDataType
META-INF/services/liquibase.configuration.ConfigurationValueProvider
META-INF/services/liquibase.logging.LogService
META-INF/services/liquibase.diff.output.changelog.ChangeGenerator
META-INF/services/liquibase.snapshot.SnapshotGenerator
META-INF/services/liquibase.executor.Executor
META-INF/services/liquibase.parser.ChangeLogParser
META-INF/services/liquibase.structure.DatabaseObject
META-INF/services/liquibase.servicelocator.ServiceLocator
META-INF/services/liquibase.serializer.ChangeLogSerializer
META-INF/services/com.datical.liquibase.ext.rules.core.AbstractLiquibaseRule
META-INF/services/liquibase.diff.compare.DatabaseObjectComparator
META-INF/services/liquibase.parser.SnapshotParser
META-INF/services/liquibase.command.LiquibaseCommand
META-INF/services/liquibase.parser.NamespaceDetails
META-INF/services/liquibase.hub.HubService
META-INF/services/liquibase.database.Database
META-INF/services/liquibase.command.CommandStep
META-INF/services/liquibase.change.Change
META-INF/services/liquibase.sqlgenerator.SqlGenerator
META-INF/maven/org.liquibase/liquibase-core/pom.xml
META-INF/MANIFEST.MF

should start with:

META-INF/
META-INF/MANIFEST.MF
@nvoxland
Copy link
Contributor Author

The jar needs the manifest.mf 2nd in the file contents??? Seriously Java???

@ktor
Copy link

ktor commented Mar 17, 2022

Hi @nvoxland,

to make current 4.8.0 version work I use OSGi wrapping technique with following bnd.bnd configuration:

Bundle-SymbolicName: wrapper.liquibase-core
Bundle-Version: 4.8.0
Export-Package: *
Import-Package: \
    javax.activation.*;resolution:=optional,\
    javax.servlet.*;version="[2.6,4)";resolution:=optional,\
    javax.sql.*,\
    org.osgi.*,\
    org.yaml.snakeyaml.*;resolution:=optional,\
    *;resolution:=optional
-includeresource: \
    liquibase-core*.jar;lib:=true

bnd.bnd file (sibling to pom.xml) is interpreted with bnd plugin and manifest file is packed with jar plugin:

<plugin>
    <groupId>biz.aQute.bnd</groupId>
    <artifactId>bnd-maven-plugin</artifactId>
    <version>4.3.0</version>
    <executions>
	    <execution>
		    <goals>
			    <goal>bnd-process</goal>
		    </goals>
	    </execution>
    </executions>
    <dependencies>
	    <dependency>
		    <groupId>biz.aQute.bnd</groupId>
		    <artifactId>biz.aQute.bndlib</artifactId>
		    <version>4.3.0</version>
	    </dependency>
    </dependencies>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.2.0</version>
    <configuration>
        <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
        </archive>
    </configuration>
</plugin>

@kataggart kataggart added this to the NEXT milestone Mar 21, 2022
@driessamyn
Copy link

Unrelated to manifest order in the JAR, but could you please re-open #2361 as the issue still exists. I updated the ticket with the details.
I also manually fixed up the manifest and verified this fix.
Any chance a patch could be released with this fix?

@kataggart
Copy link
Contributor

@driessamyn just in case you don't see my comment on #2361 we are fixing this here #2672 (comment) and are actually looking for user verification on the new format if you have a moment that issue has a copy of the new MANIFEST.MF. We'd love for you and others who were impacted by this to take a look and verify it works before we do the full new release. Thanks!!

@kataggart
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants