You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by moraleslos <mo...@hotmail.com> on 2013/04/06 18:47:56 UTC

Issue with ManifestResourceTransformer and string length limit for main class

Hi,

I've added a maven-shade-plugin for the infamous Spring issues when creating
an uber jar.  Anyway in my ManifestResourceTransformer I specify my
executable class.  When I run mvn clean/install and then try to execute the
jar, I get a class not found issue.  When I expand the jar file that Maven
created and opened the Manifest.MF file, the class name for Main-Class was
placed in two lines.  This is what it looks like:

----------------------------------------------------------------------
Manifest-Version: 1.0
Build-Jdk: 1.7.0_17
Built-By: Dell
Created-By: Apache Maven
Main-Class: com.albeingters.buslogics.variablespeedcontroller.BusVSGat
e
Archiver-Version: Plexus Archiver
----------------------------------------------------------------------

Notice above that the "e" was put on the next line.  For testing purposes,
when I truncated the class name a couple of characters, everything seemed to
work fine.  So looks like Maven has some type of string length limit for the
main class.  Below is my pom configuration for that shader:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-shade-plugin</artifactId>
	<version>2.0</version>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>shade</goal>
			</goals>
			<configuration>
				<minimizeJar>true</minimizeJar>
				<transformers>
					<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
						<resource>META-INF/spring.handlers</resource>
					</transformer>
					<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
						<resource>META-INF/spring.schemas</resource>
					</transformer>
					<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer">
					</transformer>
					<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
						<manifestEntries>
							<Main-Class>${app.main.class}</Main-Class>
						</manifestEntries>
					</transformer>
				</transformers>
			</configuration>
		</execution>
	</executions>
</plugin> 


Using JDK 1.7_17 and Maven 3.0.5 command line



--
View this message in context: http://maven.40175.n5.nabble.com/Issue-with-ManifestResourceTransformer-and-string-length-limit-for-main-class-tp5752842.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Issue with ManifestResourceTransformer and string length limit for main class

Posted by Wayne Fay <wa...@gmail.com>.
> I've added a maven-shade-plugin for the infamous Spring issues when creating
> an uber jar.  Anyway in my ManifestResourceTransformer I specify my

Which "infamous" Spring issues are you talking about?

> jar, I get a class not found issue.  When I expand the jar file that Maven
> created and opened the Manifest.MF file, the class name for Main-Class was
> placed in two lines.  This is what it looks like:
...
> Main-Class: com.albeingters.buslogics.variablespeedcontroller.BusVSGat
> e

Read the manifest spec again. [1] The line split is legal and
required. The executing JRE should handle it just fine. If it is not,
that is a bug in your JRE.

Wayne


[1] http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Notes_on_Manifest_and_Signature_Files
Notes on Manifest and Signature Files
Following is a list of additional restrictions and rules that apply to
manifest and signature files.
...
Line length:
No line may be longer than 72 bytes (not characters), in its
UTF8-encoded form. If a value would make the initial line longer than
this, it should be continued on extra lines (each starting with a
single SPACE).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org