Paul McKenzie
Paul McKenzie

Reputation: 20094

appassembler and long classpath

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?

Upvotes: 4

Views: 2353

Answers (7)

Piyush Sagar
Piyush Sagar

Reputation: 3129

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.

Upvotes: 1

gbronner
gbronner

Reputation: 1945

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>

Upvotes: 3

Petar Tahchiev
Petar Tahchiev

Reputation: 4386

I have filed a JIRA issue here:

http://jira.codehaus.org/browse/MAPPASM-203

You can go and vote for it.

Upvotes: 0

pards
pards

Reputation: 1166

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>

Upvotes: 1

Brett Porter
Brett Porter

Reputation: 5867

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.

Upvotes: 1

Paul McKenzie
Paul McKenzie

Reputation: 20094

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.

Upvotes: 1

Yaneeve
Yaneeve

Reputation: 4779

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.

Upvotes: 0

Related Questions