java.lang.NoClassDefFoundError using Wildfly, Maven, Rest? - eclipse

I have 2 Maven projects, and let's say I'm using Project2 as a dependency in Project1.
Project2 is using Java Security and has some encrypting methods.
I ran the command mvn install in Project2 and then this is how I am adding the dependency in Project1:
<dependency>
<groupId> myProject2groupId </groupId>
<artifactId> myProject2artifactId </artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
And I added this in Project2 pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>ProjectJARs/project</finalName>
</configuration>
</plugin>
The import of the classes and methods of Project2 in Project1 are perfectly working, giving me no errors when I try to compile as a Java Application and printing in console.
But when I'm running it on the Wildfly server and applying GET/POST methods from my rest endpoints, it gives me this error:
org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: simmetricClasses/SimmetricCriptography
(In Project1 Maven Dependencies I can see Project1's folder with this [without test code])
Can someone help me with this error?
Thanks a lot

This is the pom.xml of the project I want to use as a module:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupId</groupId>
<artifactId>myartifactId</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>ProjectJARs/project</finalName>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
Is this correct?

Related

Updating play framework project to Java 11 and cannot find correct dependency versions

Updating an existing maven project from Java 8 to 11, and I'm struggling to find the right combination of dependency and plugin versions.
One of the modules uses the play framework, with its associated dependencies, here's what they are set to now:
java: 11.0.5
scala: 2.12.8
sbt: 0.13.17
sbt-compiler-maven-plugin: 1.0.0
sbtrun-maven-plugin: 1.0.1
play: 2.6.21
play2-maven-plugin: 1.0.0-rc5
play2-provider-play26: 1.0.0-rc5
akka: 2.5.27
Which is giving me the following build error:
[ERROR] Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance (default-play2-enhance) on project services: Execution default-play2-enhance of goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance failed: An API incompatibility was encountered while executing com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance: java.lang.NoSuchMethodError: 'scala.collection.mutable.ArrayOps scala.Predef$.byteArrayOps(byte[])'
[ERROR] -----------------------------------------------------
[ERROR] realm = extension>com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
...
...
...
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
Note: I am hoping to keep akka to version 2.5.x, as 2.6.x requires a lot of code changes, but will go to a higher version if necessary
<?xml version="1.0"?>
<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>
<parent>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
</parent>
<artifactId>artifactId</artifactId>
<packaging>play2</packaging>
<name>name</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>typesafe</id>
<url>http://repo.typesafe.com/typesafe/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play_2.12</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play-test_2.12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play-java_2.12</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream_2.12</artifactId>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
</dependency>
</dependencies>
<build>
<!-- Play source directory -->
<sourceDirectory>${basedir}/app</sourceDirectory>
<testSourceDirectory>${basedir}/test</testSourceDirectory>
<resources>
<resource>
<directory>${basedir}/conf</directory>
</resource>
<resource>
<directory>${basedir}/public</directory>
<targetPath>public</targetPath>
</resource>
<resource>
<directory>${basedir}/target/sbt/web/public/main</directory>
<targetPath>public</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.google.code.play2-maven-plugin</groupId>
<artifactId>play2-maven-plugin</artifactId>
<version>1.0.0-rc5</version>
<extensions>true</extensions>
<configuration>
<mainLang>java</mainLang>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.play2-maven-plugin</groupId>
<artifactId>play2-provider-play27</artifactId>
<version>1.0.0-rc5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>default-play2-enhance</id>
<goals>
<goal>enhance</goal>
</goals>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>dist</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
<artifactId>sbt-compiler-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>com.google.code.sbtrun-maven-plugin</groupId>
<artifactId>sbtrun-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>compile-assets</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<args>web-assets:assets</args>
<jvmArgs>-Dscala.version=2.12.8</jvmArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- <!– These empty tags keep IntelliJ quiet –> -->
<name />
<regex />
<source />
<value />
<fileSet />
<artifacts>
<artifact>
<file>${project.build.directory}/service-${project.version}-dist.zip</file>
<type>zip</type>
<classifier>dist</classifier>
</artifact>
</artifacts>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>eclipse</id> <!-- for M2Eclipse only -->
<build>
<directory>${project.basedir}/target-eclipse</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<skipMain>true</skipMain>
<skip>true</skip>
<source>11</source>
<target>11</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<goals><goal>compile</goal></goals>
</execution>
<execution>
<id>default-testCompile</id>
<goals><goal>testCompile</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Edit:
Updated SBT and Scala version, added redacted pom
As per scala documentation
https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
Your SBT version is not compatible with Java 11. I would recommend upgrading to sbt.version=1.2.3
Akka version you are using should be good if you don't want to upgrade to higher.
Update:
I can see you updated sbt version to 0.13.17 and you tried with higher, but you should forget that sbt 0.13 and stick with sbt 1.x since sbt 0.13 is using scala 2.10, and sbt 1.x scala 2.12.
I've also noticed that you don't have version tag for maven-compiler-plugin. If you are using maven 3, it should fail to build because of missing this tag, and since it's not, I guess you are using maven 2 which should be upgraded. Also you should add 3.8.0 version tag to maven-compiler-plugin.
Check this guide to see how to properly configure this plugin for java 11. You should also check other instructions to see if everything is properly configured.

Why isn't my dependency listed in my manifest.mf?

I have an EJB project that requires org.apache.commons.lang3. I have in my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kable.newsstand.kdsejb</groupId>
<artifactId>kds-ejb</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>com.kable.maven</groupId>
<artifactId>kable-super-pom</artifactId>
<version>[0.1,1.0)</version>
</parent>
<dependencies>
....
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>ejbModule</sourceDirectory>
<resources>
<resource>
<directory>ejbModule</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestEntries>
<Dependencies>org.apache.commons.lang3</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I Project > Export > EJB Jar File, the dependency isn't listed in the MANIFEST.MF
Manifest-Version: 1.0
Built-By: BRay
Build-Jdk: 9.0.1
Created-By: Maven Integration for Eclipse
I have included the maven-ejb-plugin
I also included the archive -> manifestEntries -> dependencies nodes for the plug-in
Ok, #khmarbaise 's response, lead me to look at some stuff and my results are as follows.
Change the maven-ejb-plugin configuration in the pom.xml as follows.
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<jarName>kdsSession</jarName> <!-- I need a different jar name -->
<outputDirectory>${basedir}</outputDirectory> <!-- I want my jar in the root, not the /target -->
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestEntries>
<Dependencies>org.apache.commons.lang3</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
Then I created a new Run Configuration "Run as maven build..." with ejb:ejb for the goal.
I use the new Runtime configuration to build the ejb.jar instead of the Export -> EJB Jar.

Spark - java.lang.ClassNotFoundException in a scala jar built with Maven

I am trying to generate in Eclipse (exactly with sts-3.8.2.RELEASE) a jar from a scala project. I am going to reproduce the whole process:
Firstly I created a Maven project using maven-archetype-quickstart 1.1, and in configured I added the Scala Nature.
Then I went to Properties -> Java Build Path -> Source -> Add Folder and under src I added /main/scala and also /test/scala
I removed the src/main/java and src/test/java since I am not going to use them.
Finally in Properties -> Scala Compiler -> Use Project Settings I selected: Fixed Scala Installation: 2.10.6(built-in)
So the structure of my project is like follows:
Then I created two simple objects scripts:
App.scala
package com.examples
object App {
def main(args: Array[String]) = {
val mParam1 = args(0).trim()
val mParam2 = args(1).trim()
DataProcessing.Processing(mParam1, mParam2)
}
}
DataProcesing.sala
package com.examples
object DataProcessing {
def Processing(param1 : String, param2 : String){
println("The Param1 is: "+param1)
println("The Param2 is: "+param2)
}
}
Now to generate a Jar I tried to follow this tutorial
So my pom.xml looks like:
<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>com.example</groupId>
<artifactId>TestScala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestScala</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.examples.TestScala.App</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Then I Run As -> Maven build -> I introduced the following goals:
clean package
I got:
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.076 s
[INFO] Finished at: 2017-10-11T12:50:08+04:00
[INFO] Final Memory: 16M/145M
Then Maven -> Update Project -> checked Force Update of Snapshot/Releases
So the jar was generated. Now the project looks like:
Finally I commit to a cluster the jar and I run it using spark-submit (This is because in the future I want to create a Spark project based on this)
spark-submit --class com.examples.TestScala.App --master yarn://12.234.67.89:7077 --deploy-mode cluster /home/user/TestScala-0.0.1-SNAPSHOT-jar-with-dependencies.jar "path" "date"
But I am getting the following error:
reason: Uncaught exception: java.lang.ClassNotFoundException: com.examples.TestScala.App
I also want to mention after reading this post I tried to change the plugin to build the application (since I have no dependencies so far not sure if it will make any effect). So with this new 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>TestScala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestScala</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<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>TestScala.App</mainClass>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And the I chosed the highlighted jar (the shaded) to run in the cluster.
But I have the same error.
What am I missing?
Thanks for your time and help

how to solve the dependency missing in eclipse by mvn? [duplicate]

This question already has answers here:
How can I make eclipse make use of packages downloaded by maven?
(2 answers)
Closed 9 years ago.
I get a java servlet project from github, it use mvn to compile ,and use jetty as the servlet container.Since I never used mvn ,so I get much problems/.
question 1:
When I run mvn install , it says "BUILD SUCCESS",but after I import this project into eclipse, many packages imported cannot be resolved by eclipse. Why ?It seems that when I run "mvn install",mvn has downloaded all dependencies for me.
question 2:
How to deploy my project to jetty and then run all jUnit test cases ?
question 3:
when I run "mvn jetty:run",it says:
No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
Google says I should add jetty plugins to mvn configuration .But I am confused about the project.Why doesn't the project developers add this to pom.xml?Or, there exist other solutions?
below is the simple project directory.Project name is http-request.
[root#localhost http-request]# ls
lib pom.xml README.md
[root#localhost http-request]# cd lib
[root#localhost lib]# ls
pom.xml src target
pom.xml under http-request:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kevinsawicki</groupId>
<artifactId>http-request-parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>lib</module>
</modules>
</project>
pom.xml under http-request/lib:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.github.kevinsawicki</groupId>
<artifactId>http-request</artifactId>
<version>5.5-SNAPSHOT</version>
<url>https://github.com/kevinsawicki/http-request</url>
<description>Library for making HTTP requests</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<url>https://github.com/kevinsawicki/http-request/issues</url>
<system>GitHub Issues</system>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>8.1.9.v20130131</jetty.version>
</properties>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/kevinsawicki/http-request</url>
<connection>scm:git:git://github.com/kevinsawicki/http-request.git</connection>
<developerConnection>scm:git:git#github.com:kevinsawicki/http-request.git</developerConnection>
</scm>
<developers>
<developer>
<email>kevinsawicki#gmail.com</email>
<name>Kevin Sawicki</name>
<url>https://github.com/kevinsawicki</url>
<id>kevinsawicki</id>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Require-Bundle />
<Export-Package>!.,com.github.kevinsawicki.http</Export-Package>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.8</version>
<configuration>
<message>Generated site for ${project.name} ${project.version}</message>
<noJekyll>true</noJekyll>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>site</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
<configuration>
<dependencyDetailsEnabled>true</dependencyDetailsEnabled>
<dependencyLocationsEnabled>true</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<!-- Used to test proxy -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
There are several issues raised. Let me divide my answer.
Running builds as root
I highly recommend that you stop running builds as root.
[root#localhost http-request]# ls
lib pom.xml README.md
[root#localhost http-request]# cd lib
[root#localhost lib]# ls
pom.xml src target
This is a dangerous practice. Create a normal user account on your system and use this.
Dependencies missing in Eclipse
I have tested the project you are building and confirmed that it builds as follows:
git clone https://github.com/kevinsawicki/http-request.git
cd http-request
mvn install
You state that it fails when run from within Eclipse? Could this be because you have not installed the Eclipse plugin for Maven? See the following question:
How can I make eclipse make use of packages downloaded by maven?
No plugin found for prefix 'jetty'
This error is being thrown because the build has not been configured to use jetty. You need to read the documentation on how to enable this in your build
http://www.eclipse.org/jetty/documentation/current/maven-and-jetty.html
Your question here:
Google says I should add jetty plugins to mvn configuration .But I am confused about the project.Why doesn't the project developers add this to pom.xml?Or, there exist other solutions?
Needs to be addresses to the developer of the project. The most likely explanation is that he is not using Jetty to test his code. For example in my projects I use a continuous integration server (Jenkins) which automatically builds, deploys and tests code every time a code commit is made.

Packaging WAR with Java and Scala sources

I would like to ask you simple question. Is it possible to package WAR file which will contain Scala and Java sources, each from separate source directory (src/main/java/... and src/main/scala/...)? Of course, I still like to contain other resources like images and static pages into resulting WAR.
I've been looking into WAR plugin capabilities, regarding additional sources, but I didn't find anything helpful in this area. Can anyone give me a hint, where should I look for solution, or perhaps any kind of help?
Thanks,
Matthew
Here is a cut down version of the pom I use for my multi-language projects.
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sksamuel</groupId>
<artifactId>test</artifactId>
<version>0.33-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.plugin.jar.version>2.4</maven.plugin.jar.version>
<maven.plugin.war.version>2.3</maven.plugin.war.version>
<maven.plugin.resources.version>2.6</maven.plugin.resources.version>
<maven.plugin.compiler.version>3.1</maven.plugin.compiler.version>
<maven.plugin.surefire.version>2.14.1</maven.plugin.surefire.version>
<maven.plugin.dependency.version>2.4</maven.plugin.dependency.version>
<maven.plugin.scala.version>3.1.5</maven.plugin.scala.version>
<compiler.version.source>1.7</compiler.version.source>
<compiler.version.target>1.7</compiler.version.target>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.2</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.plugin.war.version}</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${maven.plugin.scala.version}</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
After running mvn clean package inside that directory, with a scala source in src/main/scala and a java source file in src/main/java this is what I get. And as you can see the scala and java files have both been compiled into the war.
$ find .
.
./pom.xml
./target
./target/test
./target/test/WEB-INF
./target/test/WEB-INF/lib
./target/test/WEB-INF/lib/scala-library-2.10.2.jar
./target/test/WEB-INF/classes
./target/test/WEB-INF/classes/ILoveJava.class
./target/test/WEB-INF/classes/ILoveScala$.class
./target/test/WEB-INF/classes/ILoveScala.class
./target/test/WEB-INF/web.xml
./target/test/META-INF
./target/classes.-1172594870.timestamp
./target/maven-archiver
./target/maven-archiver/pom.properties
./target/test.war
./target/classes
./target/classes/ILoveJava.class
./target/classes/ILoveScala$.class
./target/classes/ILoveScala.class
./target/surefire
./src
./src/main
./src/main/webapp
./src/main/webapp/WEB-INF
./src/main/webapp/WEB-INF/web.xml
./src/main/java
./src/main/java/ILoveJava.java
./src/main/scala
./src/main/scala/ilovescala.scala