Jump to content

Hello,

 

I think I'm going insane. I have been at this for hours and so far i've only achieved frustration.

 

I'm trying to make an actual executable of the program I've been working on - it uses apache wicket, so if I want a standalone application I need to package jetty dependencies in too. I'm also using maven for dependencies.

 

I can't figure out how to build the damn thing. I tried the normal eclipse export - it doesn't work, it keeps complaining things are missing and even though I could almost fix it by literally copying file to the .jar I eventually hit the brick wall of not knowing what the error message was raving on about. I tried building it with maven, but I can't find anything helpful on how I'm supposed to do this online. Every answer and guide I've found do_not_work - it still complains about not finding things. To top it all off, maven bugs out every. single. time.  and I have to refresh the whole environment to get it to bloody work again. >:(

 

At this point I'm desperate. I've asked on stackoverflow but nobody seems to know what the hell I should be doing. If anyone could guide me through writing a maven configuration that will allow me to do this I'd be eternally grateful.

 

This is the pom.xml I have right now:

Spoiler

<?xml version="1.0" encoding="UTF-8"?>

<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">

	<modelVersion>4.0.0</modelVersion>
	<groupId>pipe</groupId>
	<artifactId>pipe</artifactId>
	<packaging>war</packaging>
	<version>1.0</version>
	<!-- TODO project name -->
	<name>pipe</name>
	<description />
	<!-- <organization> <name>company name</name> <url>company url</url> </organization> -->
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>
	<properties>
		<wicket.version>7.4.0</wicket.version>
		<jetty9.version>9.2.13.v20150730</jetty9.version>
		<log4j.version>2.5</log4j.version>
		<junit.version>4.12</junit.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<!-- allowed values: R7, 1.0, 1.5, 2.0 or none -->
		<wtp.version>none</wtp.version>
	</properties>
	<dependencies>
		<!-- WICKET DEPENDENCIES -->
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-core</artifactId>
			<version>${wicket.version}</version>
		</dependency>

		<!-- OPTIONAL DEPENDENCY <dependency> <groupId>org.apache.wicket</groupId> 
			<artifactId>wicket-extensions</artifactId> <version>${wicket.version}</version> 
			</dependency> -->
		<dependency>
			<groupId>org.wicketstuff</groupId>
			<artifactId>wicketstuff-editable-grid</artifactId>
			<version>7.6.0</version>
		</dependency>
		<dependency>
			<groupId>org.wicketstuff</groupId>
			<artifactId>wicketstuff-inmethod-grid</artifactId>
			<version>7.6.0</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>5.2.5.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.wicket/wicket-datetime -->
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-datetime</artifactId>
			<version>7.6.0</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.apache.wicket/wicket-auth-roles -->
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket-auth-roles</artifactId>
			<version>7.6.0</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.10</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>6.0.5</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.wicketstuff/wicketstuff-minis -->
		<dependency>
			<groupId>org.wicketstuff</groupId>
			<artifactId>wicketstuff-minis</artifactId>
			<version>7.6.0</version>
		</dependency>


		<dependency>
			<groupId>org.wicketstuff</groupId>
			<artifactId>inmethod-grid</artifactId>
			<version>1.4.14</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server -->
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-server</artifactId>
			<version>9.4.3.v20170317</version>
		</dependency>



		<!-- LOGGING DEPENDENCIES - LOG4J -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-slf4j-impl</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>${log4j.version}</version>
		</dependency>


		<!-- JUNIT DEPENDENCY FOR TESTING -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>

		<!-- JETTY DEPENDENCIES FOR TESTING -->
		<dependency>
			<groupId>org.eclipse.jetty.aggregate</groupId>
			<artifactId>jetty-all</artifactId>
			<version>${jetty9.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<resources>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<filtering>false</filtering>
				<directory>src/test/resources</directory>
			</testResource>
			<testResource>
				<filtering>false</filtering>
				<directory>src/test/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>${jetty9.version}</version>
				<configuration>
					<systemProperties>
						<systemProperty>
							<name>maven.project.build.directory.test-classes</name>
							<value>${project.build.directory}/test-classes</value>
						</systemProperty>
					</systemProperties>
					<jettyXml>${project.basedir}/src/test/jetty/jetty.xml,${project.basedir}/src/test/jetty/jetty-ssl.xml,${project.basedir}/src/test/jetty/jetty-http.xml,${project.basedir}/src/test/jetty/jetty-https.xml</jettyXml>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.9</version>
				<configuration>
					<downloadSources>true</downloadSources>
					<wtpversion>${wtp.version}</wtpversion>
				</configuration>
			</plugin>
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>3.0.0</version>
				<configuration>
					<archive>
						<manifest>
							<mainClass>pipe.Main</mainClass>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

	<repositories>
		<repository>
			<id>Apache Nexus</id>
			<url>https://repository.apache.org/content/repositories/snapshots/</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
</project>

 

there are probably residues of things I've tried and failed.

 

the main class is in the "pipe" package and is called Main.

 

Thanks in advance for any help and sorry for turning this into a half rant.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
https://linustechtips.com/topic/767491-java-maven-wicket-wars-and-insanity/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×