Maven - how can I add an arbitrary classpath entry to a jar?

I found that there is an easy solution for this problem. You can add a element to element, and set true to element. So value of element is added to class-path automatically.Example.

I found that there is an easy solution for this problem. You can add a element to element, and set true to element. So value of element is added to class-path automatically.

Example: org.apache.maven. Plugins maven-jar-plugin true true your.main. Class ../conf.

Update: Here's how to filter a classpath into a custom manifest. The maven-dependency-plugin's build-classpath goal can be configured to output the classpath to a file in the properties format (i.e. Classpath=classpath).

You then configure the filters element to use the generated classpath file, and configure the resources directory to be filtered. For example: maven-dependency-plugin 2.1 generate-resources build-classpath true ${project.build. Directory}/classpath.

Properties maven-jar-plugin ${project.build. OutputDirectory}/META-INF/MANIFEST. MF ${project.build.

Directory}/classpath. Properties src/main/resources true Then specify the following in src/main/resources/META-INF/Manifest. MF: Bundle-Version: 4.0.0 ... Classpath: ${classpath};specify additional entries here Note: there is a bug with this processing using the standard window path separator (\), the generate path is stripped of separators (note it works fine on Linux).

You can get the classpath to be generated correctly for Windows by specifying \\\\ in the build-classpath goal's configuration. You can customise the manifest in the jar-plugin's configuration. To do so you'd add something like this to your pom.Org.apache.maven.

Plugins maven-jar-plugin ... true true development ${pom. Url} value ... The full archiver specification provides quite a few options. See the examples page for options on configuring the classpath.

If none of these work for you, you can define your own Manifest, set up properties containing the required entries and use a filter to populate the manifest with those properties.

I know how to use filtering, but I couldn't figure out how to filter the classpath into a file. Is there a built-in property for the classpath? – Ken Liu Oct 2 '09 at 17:43 I included a link to the filtering section of the getting started guide, you just need to configure the resources directory that contains the manifest to enable filtering.

The page includes an example to do this – Rich Seller Oct 2 '09 at 17:49 Thanks, but what is the magic maven property that inserts the classpath into the filtered manifest file? – Ken Liu Oct 2 '09 at 17:55 +1 nice approach to a very dirty situation – Pascal Thivent Oct 2 '09 at 20:32 Thanks, it's the first time I've tried generating a filter file, opens some interesting possibilities... – Rich Seller Oct 2 '09 at 20:33.

Try to do it like they do in this bug, i.e. Merge entries using manifestEntries/Class-Path element jira.codehaus.org/browse/MJAR-41.

I found that there is an easy solution for this problem. You can add a element to element, and set true to element. So value of element is added to class-path automatically.

Example.

Update: Here's how to filter a classpath into a custom manifest.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions