Showing posts with label Maven. Show all posts
Showing posts with label Maven. Show all posts

Thursday, February 1, 2018

Maven Issues


Sometimes maven install won't work. Check below cases:
  1. Invalid Java is set as first occurance in "Path" variable
  2. Ensure below <project> tag representation in the pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  • In Eclipse, right click on pom.xml -> Run as -> maven install

Monday, August 20, 2012

Friday, July 27, 2012

jars in jar

How to include dependance jar files as part of jar creation?

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.pramod.MainClass</mainClass>
                                </transformer>
                            </transformers>
                            <artifactSet>
                                <excludes>
                                    <exclude>junit:junit</exclude>
                                    <exclude>jmock:*</exclude>
                                    <exclude>*:xml-apis</exclude>
                                    <exclude>org.apache.maven:lib:tests</exclude>
                                </excludes>
                            </artifactSet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Command Line using jar utility:
jar -cf myjar.jar *.class \lib\*.jar

Wednesday, July 18, 2012

Maven


The Maven Help plugin will show local settings, including the local repository path:

mvn help:effective-settings

To create a project interactively:

mvn archetype:generate



Monday, July 16, 2012

MANIFEST.MF is not refreshed during jar generation

I created a new maven module, then I added some java source code. I also modified MANIFEST.MF file also. But while performing Run As -> Maven Project, the generated jar doesn't contains the modified MANIFEST.MF file.

The reason being is "MANIFEST.MF" should end with  a empty line. That means, after all adding any content, just click enter and save the file.

It worked for me.

In other words:

The last line in the manifest must end with a newline character. Otherwise, the manifest will not be read correctly. It is a common error to produce a text file containing just the Main-Class line without a line terminator.