0

I have been trying for some time to work out why my maven / pom config is not including dependancies in the jar package. I have included the pom below. I am using "mvn package". I don't even seem to be able to get it to build the "chartscan2... " named package. Probably due to a lack of understanding of Maven - or a brain fade - any guidance appreciated!

This seems to be related i part to targets not being executed - see answer below

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>foo.bar.onpremise</groupId>
    <artifactId>onpremise-3m-plugin</artifactId>
    <version>1.0.12-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>onpremise 3M plugin</name>


    <properties>
        <jdk.version>1.8</jdk.version>
        <mvn.compiler.version>3.6.1</mvn.compiler.version>
    </properties>

    <repositories>
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>
    </repositories>
    <dependencies>

        <dependency>
            <groupId>foo.bar.onpremise</groupId>
            <artifactId>onpremise-plugin</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-core</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>javax.media.jai</groupId>
            <artifactId>com.springsource.javax.media.jai.core</artifactId>
            <version>1.1.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator -->
        <dependency>
            <groupId>net.coobird</groupId>
            <artifactId>thumbnailator</artifactId>
            <version>0.4.8</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${mvn.compiler.version}</version>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                    </configuration>
                </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <finalName>chartscan2-${project.artifactId}-${project.version}</finalName>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
skyman
  • 2,255
  • 4
  • 32
  • 55
  • thank you for the reference - I have seen this but been unable to resolve the issue – skyman Dec 14 '17 at 02:53
  • by default JAR's are not intended to hold depenencies, just your compiled classes. If you insist on using the jar format, then you have to use a special plugin like mentioned here: https://stackoverflow.com/questions/16222748/building-a-fat-jar-using-maven If you have such dependencies, I recommend to use the WAR format. – JSONStatham Dec 14 '17 at 03:25
  • Thank you for the reference - it is actually a plugin for an image processing system - that required some tiff libraries - not in the main applicaiton? – skyman Dec 14 '17 at 03:39
  • Te actual issue is the tag - removed it and now all is functioal – skyman Dec 14 '17 at 23:05

0 Answers0