intellij-idea

Scala sbt file dependency from github repository

断了今生、忘了曾经 提交于 2021-02-19 05:20:13
问题 Is it possible to include a dependency from github? The repository does not have a jar file, just a build.sbt file and a source folder. 回答1: You can create a new project which points to the source in your build.sbt and then use dependsOn : lazy val projectIDependOn = RootProject(uri("git://github.com/user/Project.git")) lazy val myProject = project in file("my-project").dependsOn(projectIDependOn) An alternative approach would be to clone to github repository and then use sbt-assembly to

JAR files created by IntelliJ IDEA do not run

半腔热情 提交于 2021-02-19 03:18:47
问题 I wrote a program that spans a few classes in IntelliJ and it works fine when I was testing it in the IDE. However, whenever I follow tutorials to make my project into a .jar executable, it does not run. The file in the out folder does not run when double-click on it and says "The Java JAR file "projectName.jar" could not be launched. When opening it from the terminal, I get the error "Could not find or load main class". I used "$ java -jar projectName.jar " I followed these steps: Open

JAR files created by IntelliJ IDEA do not run

点点圈 提交于 2021-02-19 03:16:19
问题 I wrote a program that spans a few classes in IntelliJ and it works fine when I was testing it in the IDE. However, whenever I follow tutorials to make my project into a .jar executable, it does not run. The file in the out folder does not run when double-click on it and says "The Java JAR file "projectName.jar" could not be launched. When opening it from the terminal, I get the error "Could not find or load main class". I used "$ java -jar projectName.jar " I followed these steps: Open

Use of constructor reference where constructor has a non-empty parameter list

泪湿孤枕 提交于 2021-02-19 02:14:55
问题 Given.. List<Foo> copy(List<Foo> foos) { return foos .stream() .map(foo -> new Foo(foo)) .collect(Collectors.toList()); } IntelliJ IDEA 2016.1.1 reports that new Foo(foo) "can be replaced with method reference". I'm aware of the Foo::new syntax for the no-arg constructor, but don't see how I could pass foo in as an argument. I'm surely missing something here. 回答1: I'm aware of the Foo::new syntax for the no-arg constructor That's not what Foo::new does. This expression will expand to what is

Use of constructor reference where constructor has a non-empty parameter list

谁说胖子不能爱 提交于 2021-02-19 02:09:23
问题 Given.. List<Foo> copy(List<Foo> foos) { return foos .stream() .map(foo -> new Foo(foo)) .collect(Collectors.toList()); } IntelliJ IDEA 2016.1.1 reports that new Foo(foo) "can be replaced with method reference". I'm aware of the Foo::new syntax for the no-arg constructor, but don't see how I could pass foo in as an argument. I'm surely missing something here. 回答1: I'm aware of the Foo::new syntax for the no-arg constructor That's not what Foo::new does. This expression will expand to what is

Setting IntelliJ compiler args in Gradle

随声附和 提交于 2021-02-18 21:58:44
问题 I need to add the -parameters java compiler parameter for my tests to succeed. I can do this in gradle already for ./gradlew build to work, or manually by adding -parameters under IntelliJ Settings > Build.. > Compiler > Java Compiler > Additional command line parameters: so they work in the IDE, but I don't want everyone who checks out this repo to have to do a manual step. My .ipr file does show <component name="JavacSettings"> <option name="ADDITIONAL_OPTIONS_STRING" value="-parameters" />

How to run the same project multiple times in IntelliJ IDEA?

给你一囗甜甜゛ 提交于 2021-02-18 20:55:29
问题 I am developing client side of my application using IntelliJ IDEA. For debugging I need to run multiple clients. I guess running same projects in different windows is not possible with IntelliJ IDEA. So how do I run multiple clients for debugging? 回答1: You can run or debug the same Run/Debug configuration in IntelliJ IDEA several times if you enable the Allow parallel run checkbox. You will see a tab per instance in the Run or Debug tool window. In the previous IDE versions this checkbox was

run test classes from other path in testng.xml file

自古美人都是妖i 提交于 2021-02-18 19:31:34
问题 I am fairly beginner in TestNG, Maven & IntelliJ. I have created a new maven project and defined a 'runtest' class under src/main/java. I am able to run testcases through testng.xml if I specify test classes under src/main/java. However, I want to specify my test classes inside src/test/java. If I specify any test class 'test1.java' under src/test/java and run, it gives error : Error: Cannot find class in classpath: java/test1 Workarounds I already tried: In testng.xml file, giving full path

Intellij IDEA code coverage doesn't work

你离开我真会死。 提交于 2021-02-18 12:56:05
问题 When I'm trying to run my JUnit tests with coverage I receive the following error FATAL ERROR in native method: processing of -javaagent failed java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at sun.instrument

Class 'myClassName' already exists in package 'myPackageName'

非 Y 不嫁゛ 提交于 2021-02-18 12:07:08
问题 I suddenly started facing a strange issue while working on my Grails application using IntelliJ. I have different domain classes and some other classes under src/groovy . When I open a class file to make some changes, I get an error that this class already exists in package which I don't have. I tried to rename the class using refactor but after that I still get the same error. Can anybody suggest what's wrong here or if I did something wrong? 回答1: Try to "Clear" you project and build again.