How to make IntelliJ understand annotations - ide

I have recently switched from using Eclipse to IntelliJ, and am preferring the experience.
However, the IDE is not understanding any of the Annotations. I am using Spring #Autowired annotation as well as some of the Spring-WS annotations and the IDE is telling me that they are unresolved.
When the project is built using Maven, it builds fine, and the Annotations are recognised in Eclipse.
Im sure this is a simple setup thing, but cannot find any information on how to set it up.

As Peter said, when correctly importing the Maven project the dependencies should be correctly recognized. The IntelliJ manual has a section on how to import a Maven project.

For the record, in our project pom, we have the following dependencies:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
The former two have been present already before implementing a web service, so they may not be required strictly for web services.

Related

looking for org.openqa.selenium.support.ui.Select jar path

Can anyone help me to find the link of below jar
org.openqa.selenium.support.ui.Select
How did you add selenium to your project and what IDE are you using?
If you downloaded the jars manually from the selenium website then they're here:
They're in client-combined-3.141.59.jar and when you add it to your IDE you'll have the path you want.
However its not good practice to download and add them manually. You'll be stuck manually upgrading them and having trouble with remote execution.
It's much better if you use maven or gradle to manage this for you.
As one quick example, in maven you add this in you pom.xml:
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
It manages your dependencies for you. You get this in your project:

IntelliJ cannot resolve Kotlin stdlib members within bundle

According to the Kotlin docs, there is an OSGi bundle for the Kotlin standard libraries. However, if I replace kotlin-stdlib with this bundle as recommended:
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-osgi-bundle</artifactId>
<version>${kotlin.version}</version>
<type>bundle</type>
</dependency>
IntelliJ is no longer able to find any classes or functions from the stdlib (i.e. println):
If I build and run the project (with maven-pax-plugin), everything works fine - it just seems to have broken IntelliJ's analysis capabilities.
How should I properly include Kotlin as an OSGi dependency?
I am using maven-bundle-plugin to build this bundle.
If you remove the type section, it should work:
<type>bundle</type>
The Kotlin OSGi bundle is not a Maven bundle artifact.
For Intellij IDEA 2018.2, works for me, using this way :
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-osgi-bundle</artifactId>
<version>${kotlin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>

JUnit on IntelliJ not working

I tried setting up JUnit 5 on my INtelliJ IDEA Community Edition 2018.2. The jar was downloaded but I am getting Cannot resolve symbol Assertions on importing
import static org.junit.jupiter.api.Assertions.*;
Error
Are you trying to use the JUnit assertions in a regular app class rather than a test class?
Delete <scope>test</scope>
When a Maven dependency carries a scope element with a value of test, that means you cannot use that library outside of your test-specific source package/folder.
If you are trying to call JUnit from code in your example project’s src/main/java/… folder hierarchy, you will see that error. If you call JUnit from src/test/java…, you will see success.
To enable JUnit in the src/main/java/… folder hierarchy, delete the scope element in your POM dependency. So this:
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0-RC1</version>
<scope>test</scope>
</dependency>
…becomes this:
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0-RC1</version>
</dependency>
By the way, note that as of 5.4.0 of JUnit, we can specify the new and very convenient single Maven artifact of junit-jupiter which in turn will supply 8 libraries to your project.

IntelliJ doesn't autocomplete JUnit 5 Jupiter classes

I have Maven imports for JUnit 5 in an IntelliJ install, and I have invalidated the cache and restarted.
IntelliJ will refuse to autocomplete (CTRL-SPACE) any class nor any static method belonging to classes in the org.junit.jupiter.api. package, unless the class' fully qualified name is spelled out. Even when writing the package for which the class belongs, will not suggest the classes of that package.
IntelliJ version is 2017.2.1. Jupiter version is 5.0.0-RC2, platform is 1.0.0-RC2.
I am unsure how to move on from here. How come this package is the only one that seems to refuse basic completion?
<properties>
<junit.jupiter.version>5.0.0-RC2</junit.jupiter.version>
<junit.platform.version>1.0.0-RC2</junit.platform.version>
</properties>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- Only required to run tests in an IDE that bundles an older version -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<!-- Only required to run tests in an IDE that bundles an older version -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
Please check those classes are not in exclude list in File | Settings | Editor | General | Auto Import
You can try to downgrade JUnit 5 to M4 instead of RC2. IntelliJ 2017.2 is based on JUnit 5 M4, maybe that is causing the problem you are facing.

IntelliJ with flexunit4

I have a maven project where I am using flexmojos and flexunit and the tests execute fine when building through maven.
However when I try to execute a single test using IntelliJ (right click the on test - run), it creates the _flexunit.swf file and tries to execute it, however there is an exception when it runs:
VerifyError: Error #1014: Class mx.core::Application could not be found.
My knowledge of flexmojos is not great, but I believe it takes care of loading the flex sdk dependencies, however I have tried adding flex sdk dependencies directly in my pom but after that I can't even build in maven, which doesn't happen if I leave those dependencies out:
Unable to locate specified base class 'spark.components.supportClasses.ItemRenderer'
So my question is, what tells IntelliJ to configure the _flexunit.swf not to link the flex sdk? Are there some settings where I have to set these specifically?
Seems like my pom is correctly set up to run the tests (so the TestRunner.swf is fine) but the _flexunit.swf compiled by IntelliJ is missing something...
Sounds to me that you need to do something like this:
<dependency>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-unittest-flexunit4</artifactId>
<version>4.1-beta</version>
<type>swc</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>playerglobal</artifactId>
</exclusion>
<exclusion>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>airframework</artifactId>
</exclusion>
</exclusions>
</dependency>
Notice the Exclusions Tag.