I am using maven appassembler to create my assembly. My classpath is too long and I get "The input line is too long." The suggestion here is to use booter windows platform, but I'm constrained to use Java Service Wrapper. Any way I can use java6 wildcarded classpath and java service wrapper?
-
That FAQ relates to other startup scripts, not JSW. Can you post the particular error you are seeing in context, and how many classpath entries appear in the generated `wrapper.conf`? – Brett Porter Mar 29 '10 at 19:06
-
and why not use the booter platform? – Yaneeve Apr 01 '10 at 12:04
-
@Yaneeve 'I'm constrained to use Java Service Wrapper' – Paul McKenzie Apr 09 '10 at 20:47
-
@Brett, can't recall exactly, but loads. Am using corporate framework solution which has >70 dependencies some of which are bogus. – Paul McKenzie Apr 09 '10 at 20:49
7 Answers
Have you tried:
<useWildcardClassPath>true</useWildcardClassPath>
This solved the problem for me, however, if you arent already, you also need to make sure you are using:
<repositoryLayout>flat</repositoryLayout>

- 68
- 6

- 1,907
- 24
- 39
You can also try flattening the directory structure of the repository (i.e. lib) directory. By default, the appassembler preserves the deep directory structure which can add unnecessary length to the classpath.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<programs>
<program>
<mainClass>com.mycompany.app.MyApp</mainClass>
<name>runMyApp</name>
</program>
</programs>
<repositoryLayout>flat</repositoryLayout>
</configuration>
</plugin>
</plugins>
</build>

- 1,098
- 15
- 20
It seems that the answer is 'No', without writing a plugin or extending the existing plugin, which is not an 'answer' to the original question.

- 19,646
- 25
- 76
- 120
I'd suggest filing a bug in http://jira.codehaus.org/browse/MAPPASM to address it. I wrote the JSW integration and know it needs a bit more work.

- 5,827
- 27
- 25
On the windows command prompt the maximum length of the string that you can use at the command prompt is 8191 characters.
So if your project has too many dependencies, then it will generate long classpath.
To overcome this situation maven-appassembler has provided option
Add these two lines under configuration section
<configuration>
<repositoryLayout>flat</repositoryLayout>
<useWildcardClassPath>true</useWildcardClassPath>
</configuration>
Documentation for these two options : (documentation)
useWildcardClassPath:
Sometimes it happens that you have many dependencies which means having a very long classpath, and becomes too long (in particular on Windows based platforms). This option can help in such situation. If you activate this option, your classpath contains only a classpath wildcard (REPO/*). But be aware that this works only in combination with Java 1.6 and above and with repositoryLayout flat.
repositoryLayout:
The layout of the generated Maven repository. Supported types - "default" (Maven2) | "legacy" (Maven1) | "flat" (flat lib/ style). The style "legacy" is only supported if you are running under Maven 2.2.1 and before.

- 1
- 1

- 2,931
- 23
- 26
I have filed a JIRA issue here:
http://jira.codehaus.org/browse/MAPPASM-203
You can go and vote for it.

- 4,336
- 4
- 35
- 48
As a long shot...
Having never worked with JSW, perhaps you could create your own assembly plugin based on the code at http://maven.apache.org/plugins/maven-assembly-plugin/source-repository.html and use it instead.

- 4,751
- 10
- 49
- 87
-
The thing is, I was hoping to use something already written for me. Not that I'm lazy, but writing a plugin is not an easy sell in a corporate environment when the simple (but manual and un-automated) step of hacking the generated script is takes seconds. – Paul McKenzie Apr 09 '10 at 20:53