In the POM file when I add the testng dependency, I never get the option to import testng. I only get Junit. I do not have Junit as dependency.
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
As I was researching the issue I found someone faced similar issue in the link below. However I did not see a solution. Any one knows how to get around this situation? I want to use TestNG so that I can use testNG.xml to run the tests.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003437720-Why-Intellij-doesn-t-import-the-TestNG-maven-dependency-automatically-
Thanks in advance
It works for me. Make sure you have added dependency for the correct Maven module into dependencies section. After this make sure you have re-imported project in Maven tool window:
Initially I had the same problem when I copy artifacts from https://mvnrepository.com/artifact/org.testng/testng/7.3.0 and paste the code on my IntelliJ it was showing the errors, Once I have Reload from Disk(right click on project it will show the option) it was showing refresh option on the right side of the screen, once I refreshed it the error was resolved.
I tried the reload option shown in the top right corner of Intellij, that didn't work for me. Then I right clicked on project > maven > Reload Project.
After this all the maven dependencies were resolved.
Related
I am getting below errors:
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not foundenter image description here
Once any changes are made in pom.xml you must refresh it by clicking on following button (see screenshot).
It will trigger Maven to refresh and download needed dependencies/plugins according to pom.xml file.
Please reload the pom.xml by mentioned in the picture.
right click -> maven -> Reload Project
Since IntelliJ IDEA 2020.3.2 (I use Community Edition), I started getting:
Parsing java... [applicationname]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate.
Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
Writing classes
warning, upon running the application within the IntelliJ IDEA.
This actually happens during the build phase, when you run your application for the "first" time (to be more precise, when target (or whatever you have configured as a building result directory) is being built).
What does this message mean?
As IDEA's build is incremental, it uses wrapper interfaces in order to collect some data that will help incremental analysis to correctly compile files affected by changes.
The -Djps.track.ap.dependencies=false option is added in:
File > Settings/Preferences > Build, Execution, Deployment > Compiler.
Then field Build process VM options disables collection of dependencies specified by an annotation processor when Filer methods are called.
In later versions of IntelliJ, the settings is now under:
File > Settings > Build, Execution, Deployment > Compiler, then field Shared build process VM options
See some more details in this issue: IDEA-252069.
I was using an older version of Lombok, changing to newer version fixed the issue in IntelliJ
Old version:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
New version:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
In my case i was trying to use an old version lombok plugin (version 1.16.16), but it's an old plugin version, I updated to 1.18.20 (obs.: today is july 2021) and it works well.
I had to remove the target dir with rm -Rf ./target or mvn clean, then inside IntelliJIDEA's Maven panel, I clicked on the Icon "Reload all maven projects".
I also tried to "Invalidate cache and restart".
Not sure what was working but it solved my error.
We can do all operations in IntelliJ IDEA.
add -Djps.track.ap.dependencies=false in proper place.
In the right of IDEA, click Maven -> Reload All Maven Projects.
Also in the Maven -> Excute Maven Goal (represented by a 'm' icon) -> mvn clean -> enter
Then Excute Maven Goal -> mvn install -> enter
Build -> Rebuild Project.
Thank Andrey, djangofan and Falcon.
1.New version added in pom.xml
enter code here
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
enter code here
2.mvn clean -> build project
In my case,the specific error is couldn't find one class file. I open it and find the suffix magically becomes '.aj'. Change it back to '.java'. It works for me.
I know the thread is almost 2 years old, but since this came up in search.
Fo me it worked after File->'Invalidate Caches...'
I am facing a problem modifying dependencies within Intellij12.04.
Under my project folder, I have two modules, the second of which depends on the first:
a.b.c.somebusiness
---> a.b.c.tests
I want to remove one dependency from a.b.c.tests and add it into a.b.c.somebusiness module, but I don't want to create a circular dependency tree. When I try to remove the dependency from the a.b.c.tests module and add it into the a.b.c.somebusiness module, I am getting the following error:
"Source root "C:\Perforce\depot\Projest\Main\a.b.c.tests\src\test" cannot be defined in module "Main" because it belongs to content of nested module "a.b.c.tests""
I don't know what to do to resolve this issue. Can anyone suggest an approach that would fix the error I'm receiving?
You should look at using apache maven and the project object model (pom.xml file)
When you define your dependencies under <dependencies> in the pom.xml, they are managed automatically by IntelliJ. So you will never have such problems from moving dependencies into file folders manually.
If you configure it similar to the fashion shown below, your dependencies will work automagically.
<dependencies>
<dependency>
<groupId>a.b.c</groupId>
<artifactId>a-b-c-tests</artifactId>
</dependency>
<dependency>
<groupId>some.other.org</groupId>
<artifactId>some.other.dep</artifactId>
</dependency>
</dependencies>
How to get started: install apache maven and add a pom.xml at the root of your project. Right click it to add in as a maven file in IntelliJ.
Good luck!
The best approach to isolate issue faced is to use Apache Maven. It gives following advantages and will be easy for you to manage dependencies in a cleaner and efficient way. Hope this will help a new comer.
The task of downloading Jar files and other dependencies is done automatically.
In Maven, it’s easy to add new dependencies by writing the dependency code in the pom.xml file.
Makes it easy for the developer to build a project in different environments without worrying about the dependencies, processes, etc.
Having said that, please follow these steps to fix the issue.
Go to InteliJ IDEA
Right click the Project and Click Add Framework Support and check
the "Maven" option This will create pom.xml file for the project
Double click the pom.xml file and include dependencies as needed.
(The dependencies could be found by searching via
https://mvnrepository.com/)
When the dependencies are added it will automatically download, if
does not, right click the project and select "Maven" and click
"Reimport".
Now you are project is added with the dependencies you have
specified.
Once above is completed, try to build the project in order to deploy/run.
Go to Run -> Edit Configuration -> Add New Configuration -> Select
Maven -> Fill the name etc. -> Type 'clean install' in the 'Command
Line' field and press OK.
Now you can run the Maven in the Run/Debug Configurations
The output can be seen in the target folder of your project
directory.
Check this out for more information - Official Page for Apache Maven:
https://maven.apache.org/index.html
I am trying to add a WSDL module to my existing application, but I'm struggling to get the dependencies resolved.
According to their website, this is the correct dependency
<dependency>
<groupId>org.ow2.easywsdl</groupId>
<artifactId>easywsdl-wsdl</artifactId>
<version>2.1</version>
</dependency>
After a search (search.maven.org), I already changed the version to 2.3 and there are a bunch of files that are downloaded into my local repository, but when running the application (with the websites demo code), I bump into this error:
java.lang.ClassNotFoundException: com.ebmwebsourcing.easycommons.uri.UriManager
And I believe it has something to do with the missing artifacts :
com.ebmwebsourcing.easycommons:easycommons.uri:jar:1.1
com.ebmwebsourcing.easycommons:easycommons.logger:jar:1.1
In particular the first one. Now, I'm relatively new to using Maven... How would I go about solving this?
Thanks.
The solution is to add the petalslink repository. Appearantly the standard maven repository doesn't contain the easycommons dependency. The petalslink repository does.
We've just recently converted our project to using Maven for builds and dependency management, and after the conversion I'm getting the following exception while trying to run any JSFUnit tests in my project.
Exception class=[java.lang.UnsupportedOperationException]
com.gargoylesoftware.htmlunit.ScriptException: CSSRule com.steadystate.css.dom.CSSCharsetRuleImpl is not yet supported.
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
...
All the dependencies and JARs for JSFUnit were pulled with Maven using the JBoss repository (http://repository.jboss.com/maven2/).
We're using the following dependencies in the project:
jboss-jsfunit-core 1.2.0.Final
jboss-jsfunit-richfaces 1.2.0.Final
richfaces-ui 3.3.2.GA
openfaces 2.0
JSF 1.2_12
Facelets 1.1.14
Before the dependencies were being managed by Maven, we were able to run our JSFUnit tests just fine. I was able to semi-fix the issue by using a ss_css2.jar file that someone had tucked into our WEB-INF/lib directory (from before the Maven conversion). I'm hoping to find out if there's something else I can do to fix the dependencies in Maven rather than resorting to managing some of the dependencies myself.
You're very likely getting an "incompatible" version of HtmlUnit or another JAR (pulled transitively). Try with the version you were using previously and declare it under the dependencyManagement section, e.g.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.7</version><!-- put "your" version here -->
</dependency>
</dependencies>
</dependencyManagement>
Or, if you changed any version, try to revert to the exact previous state (by the way, could you clarify the differences between the previous versions and the one currently used?).
Update: It appears that the problem was related to the version of the cssparser artifact. I hadn't all the required elements to figure this out but the OP did :)