Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Troubleshooting why a maven exception is thrown from the command line but not from Intellij IDEA

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I have encountered a bizarre exception when setting up Selenium on my local Windows computer. The issue only occurs on the command line, and not when executing the maven command 'mvn clean install' from Intellij IDEA (then it works as expected).

The exception that I get is as follows:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project pfister-webdriver-fmwk: Compilation failure: Compilation failure:
[ERROR] /C:/Users/P010139/IdeaProjects/Project_Name/src/test/java/co.uk/madeupdomain/Locale_Test_Suite.java:[3,17] package org.junit does not exist

To confirm, my path has the maven bin directory on it, and the junit jar on it. Furthermore, Java SDK is also on the path

Typing, mvn -v from the command line returns the following:
Maven home: C:\project_jars\apache-maven-3.6.0\bin\..
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_181\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"


PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_181\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin;C:\project_jars\selenium-java-2.47.1\selenium-java-2.47.1.jar;C:\project_jars\selenium-server-2.47.1\selenium-2.47.1\selenium-server-2.47.1.jar;C:\project_jars\selenium-server-standalone-2.47.1.jar;C:\project_jars\junit-4.12.jar;C:\project_jars\apache-maven-3.6.0\bin;

 
Saloon Keeper
Posts: 12128
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have JUnit on your PATH? That won't actually do anything.

Your dependencies are supposed to be declared in your Maven POM.
 
Stephan van Hulst
Saloon Keeper
Posts: 12128
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!
 
Mark Robins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, thanks for the tip. I have removed it but unfortunately there is no change in behavior.

Also, I have double checked that JAVA_HOME is set as C:\Program Files\Java\jdk1.8.0_181\bin
 
Mark Robins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it complaining about "package org.junit does not exist" The dependency is there and has the version 4.12. Also, I have tried playing around with the <scope> tag and it makes no difference
 
Stephan van Hulst
Saloon Keeper
Posts: 12128
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the POM?
 
Mark Robins
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, the issue was resolved. It was due to a faulty plugin in the POM.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic