Maven wrapper inconsistent build result with locally installed maven - java

I am running a Spring Boot project with Maven wrapper.
From a console, I can run mvn clean install. From Eclipse, I can run it with right-click -> Run as -> Maven install.
However, when using the Maven wrapper from command line:
./mvnw clean install
It doesn't work. I think it is because of the following lines at the top of the output when running the wrapper:
[WARNING] The POM for org.apache.camel:camel-spring-boot:jar:2.21.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.camel:camel-core:jar:2.21.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.camel:camel-servlet:jar:2.21.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.camel:camel-sql:jar:2.21.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.camel:camel-test-spring:jar:2.21.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
And finally, the entire build fails:
Caused by: java.lang.ClassNotFoundException: org.apache.camel.spring.SpringCamelContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.camel.test.spring.CamelSpringBootExecutionListener.prepareTestInstance(CamelSpringBootExecutionListener.java:41)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
I can force it to run by pointing out a directory to download into to get a fresh install:
./mvnw clean install -Dmaven.repo.local=tmp
My main use for the wrapper is in our CI environment, which basically forces the above line since we discard the image afterwards.
My locally installed maven has the following version information (mvn -v):
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-121-generic", arch: "amd64", family: "unix"
The wrapper has the following version information (mvn -v):
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00)
Maven home: /home/kajo/.m2/wrapper/dists/apache-maven-3.5.2-bin/7hf0mht29afbpa1e4v2d1a16p0/apache-maven-3.5.2
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-121-generic", arch: "amd64", family: "unix"
I am curious as to why it doesn't work and what is the root of the problem. Compiling and testing the build takes a lot longer when I have to download fresh installs to get it work using the wrapper.

Related

Maven Build Error: java.security.InvalidAlgorithmParameterException

I am doing a maven build, but it gets an error related to one of the dependencies. If I (and other developers) build this on our local machines or on other linux servers, it builds with no problems. However, on one particular linux server, it gets the following error when building.
mvn clean install DskipTests=true -U
maven Build Error:
[ERROR] Failed to execute goal on project corporateInterface: Could
not resolve dependencies for project
com.travellinck:corporateInterface:war:3.10: Failed to collect
dependencies at
com.github.Cloudmersive:Cloudmersive.APIClient.Java:jar:v3.62: Failed
to read artifact descriptor for
com.github.Cloudmersive:Cloudmersive.APIClient.Java:jar:v3.62: Could
not transfer artifact
com.github.Cloudmersive:Cloudmersive.APIClient.Java:pom:v3.62 from/to
jitpack.io (https://jitpack.io): Transfer failed for
https://jitpack.io/com/github/Cloudmersive/Cloudmersive.APIClient.Java/v3.62/Cloudmersive.APIClient.Java-v3.62.pom:
java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors
parameter must be non-empty -> [Help 1] [ERROR]
So I think there must be something different on this server that is causing the dependency error. Any ideas please?
I see it gets a java.security.InvalidAlgorithmParameterException, so this suggests that there is probably some restriction configured on the server that is preventing the dependency being downloaded to the server.
More info:
pom.xml
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.62</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
Maven version on linux server with the error:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven
home: /home/jboss/.sdkman/candidates/maven/current Java version:
1.7.0_95, vendor: Oracle Corporation, runtime: /usr/java/java-7-openjdk-amd64/jre Default locale: en_US, platform
encoding: ANSI_X3.4-1968 OS name: "linux", version:
"3.10.0-1160.15.2.el7.x86_64", arch: "amd64", family: "unix"
Maven version of linux server that has no error:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven
home: /opt/apache-maven-3.6.3 Java version: 1.7.0_161, vendor: Oracle
Corporation, runtime:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161-2.6.12.0.el7_4.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name:
"linux", version: "3.10.0-957.21.3.el7.x86_64", arch: "amd64", family:
"unix"
Maven version on localhost that has no error:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
2015-11-10T18:41:47+02:00) Maven home:
/Users/richardmarais/Development/java/Maven/apache-maven-3.3.9 Java
version: 1.7.0_80, vendor: Oracle Corporation Java home:
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x",
version: "10.16", arch: "x86_64", family: "mac"
I fixed this issue. The problem was the Java version. I temporally build with Java 8 (to download the Cloudmersive api), then switched back to Java 7. Build is successful.

Why gradle is not loading transitive dependencies of one of the dependencies?

Updated Question
gradle is loading my project's dependency guice-3.0.jar, but guice's dependencies are NOT being loaded by gradle.
guice-3.0.jar > META-INF > DEPENDENCIES (file) has the following content:
// ------------------------------------------------------------------
// Transitive dependencies of this project determined from the
// maven pom organized by organization.
// ------------------------------------------------------------------
Google Guice - Core Library
From: 'an unknown organization'
- AOP alliance (http://aopalliance.sourceforge.net) aopalliance:aopalliance:jar:1.0
License: Public Domain
- javax.inject (http://code.google.com/p/atinject/) javax.inject:javax.inject:jar:1
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- CGLIB (http://sourceforge.net/projects/cglib/) org.sonatype.sisu.inject:cglib:jar:2.2.1-v20090111
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
From: 'ObjectWeb' (http://www.objectweb.org/)
- ASM Core (http://asm.objectweb.org/asm/) asm:asm:jar:3.1
gradle seems to be failing in loading javax.inject. So, I get the error mentioned below.
Work-around
I added guice's dependencies direct into build.gradle of my project.
compile group: 'aopalliance', name: 'aopalliance', version: 1.0
compile group: 'javax.inject', name: 'javax.inject', version: 1
compile group: 'org.sonatype.sisu.inject', name: 'cglib', version: '2.2.1-v20090111'
compile group: 'asm', name: 'asm', version: 3.1
Questions
It works as a hack, but any genuine fixes are required.
Looking at other jars required by my project, they have dependencies defined in META-INF > maven > lib-name-folder-hierarchy > pom.xml, but this guice-3.0.jar has dependencies defined in META-INF > DEPENDENCIES file. Can this different convention cause any issues?
Original Question
For one of my java projects, I performed gradlew --refresh-dependencies, and the project build compileJava task started throwing the following error:
:myproject:compileJava
/<path-to-my-project/MyProvider.java:24: error: cannot access Provider
public class MyProvider<T> implements Provider<T> {
^
class file for javax.inject.Provider not found
An exception has occurred in the compiler (1.8.0_181). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.Attr.visitTypeParameter(Attr.java:4016)
at com.sun.tools.javac.tree.JCTree$JCTypeParameter.accept(JCTree.java:2224)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4296)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4272)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4176)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:104)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:53)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:163)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:145)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
:myproject:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myproject:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------
Build time: 2016-07-18 06:38:37 UTC
Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Mac OS X 10.12.6 x86_64
It's openJDK.
Well, my team-mates, who haven't performed gradlew --refresh-dependencies are facing no such issues. I don't think it's java compiler issue, but it seems to be gradle issue.
When I check using eclipse, the MyProvider.java refers to com.google.inject.Provider from guice-3.0.jar.
com.google.inject.Provider refers to javax.inject.Provider, and that seems to be not included in the dependencies.
Any solutions to resovle the issue?
Any ways to rollback the refresh-dependencies command?
Any work-arounds?
I performed cleanEclipse, eclipse, upgraded gradle to 3.5, and then downgraded to 2.14.1, but no luck.
The similar issue was reported to java but it was closed as Cannot Reproduce: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8222198 .

mvn build is failing for tigase-web-ui-2.0 final

We downloaded the pom.xml available at
https://projects.tigase.org/projects/sureim/repository/revisions/33b2a6f9cc27ced875f7e773f041ac381e2115b9
for
tigase-web-ui-2.0 final
and mvn build is failing
[ERROR] Failed to execute goal on project tigase-web-ui: Could not
resolve dependencies for project
tigase.sure.web:tigase-web-ui:war:2.0: Could not find artifact
tigase.sure.web:theme:jar:2.0.0 in gwt-mobile-webkit
(http://gwt-mobile-webkit.googlecode.com/svn/repo) -> [Help 1]
Where do we find the relevant war / jar files.
Our mvn version is
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: D:\Spacers\Gurupgm\Apache-maven-3.3.3\bin..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: D:\Spacers\Gurupgm\Java8\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Thanks for your help.
Try downloading the jar manually from the link click
After downloading install into maven repository by using the below command
mvn install:install-file -DgroupId=tigase.sure.web
-DartifactId=vomsProxyInitGUI -Dversion=2.0 -Dpackaging=jar -Dfile=/home/tigase-web-ui-2.0.jar

Maven 3.1.0 breaks Google App Engine Maven Plugin

Looks likes Google App Engine plugin is broken with new maven 3.1.0 release. When I am trying to run development server, I am getting exception
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystem
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 57 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
My maven version is
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 05:15:32+0300)
Maven home: C:\Program Files\Maven\apache-maven-3.1.0
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
There is a conluence page about this problem on Apache site http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound
If you need to use the plug-in with Maven 3.1.0 then you can use the latest 1.8.3-SNAPSHOT version (from the Sonatype repository, see below) which has this problem fixed.
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.8.3-SNAPSHOT</version>
</plugin>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
</pluginRepository>
See also this question:
Move to version 3.8.0 of the android-maven-plugin, it solves the issue.
I had the same problem, but moving back to Maven 3.0.5 solved the problem

Jersey 2.0 "Getting Started" guide, mainClass not found

Hi I am trying to follow the Getting Started guide for Jersey 2.0.
I did steps 1.1 and 1.2 as is. No problem there.
For step 1.3 I had a problem cause maven could not find the javax-annotation 1.2 but I solved it following the advice of another Stackoverflow user and added a repository to my pom.
Somvn clean test passes with no problems, BUT when I try to run mvn clean exec:java I get back
[WARNING] java.lang.ClassNotFoundException: com.example.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:722)
The pom.xml is the one created by the following command:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example \
-DarchetypeVersion=2.0
where the only addition I 've made is the following:
<repositories>
<repository>
<id>java.net.repo</id>
<url>https://maven.java.net/content/groups/promoted/</url>
<layout>default</layout>
</repository>
</repositories>
In case it is of interest this is the output of mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre
Default locale: el_GR, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"
I am able to reproduce your error. This has nothing to do with Jersey; it's an error you're making with Maven. mvn clean exec:java says: "delete all the .class files and then try to run the Main .class file". Since you deleted it, Maven can't find it. Here's a solution:
mvn clean compile exec:java
This should fix the problem in your question. This says "delete all the .class files, recompile them from source and then try to run the Main .class file"
To get past the next error you'll see, delete the <scope>test</scope> line from the client dependency in the pom.xml:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<scope>test</scope>
</dependency>
To:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>

Categories