I have maven projects, opened in my Eclipse.
After each code changing I should to launch task1, task2, .... taskN.
Each task executes from different folder.
Is it possible to create task which would invoke task1 then task2 .... taskN ?
If task45 ended in failure then from task46 to taskN is not launch.
UPDATE
I created aggregate task:
This feature does not seem to be supported by eclipse yet (Apr 2014). It is a known issue and a ticket is already open for it.
However, you can have a look to the "launch group" feature from the CDT plugin. It seems to be compatible with any launch configuration, including maven, and it should offer better control on sequantial execution of your tasks.
Related
I have a project that I want to build with Maven but run with IntelliJ, i.e. not delegate run actions to Maven. I have an Application Run Configuration that points at the main class of my project, with a Before Launch action of 1. Run Maven Goal 'Project Name: compiler:compile'. The FIRST time only that I run this config, I get:
Error: Could not find or load main class xx.Main
Caused by: java.lang.ClassNotFoundException: xx.Main
And on subsequent (using the exact same run config) runs, it works perfectly.
Note: if I have a separate Maven Build Target for my project and I run that first and then the Application Run Target (without the build before launch), it works first try. I've also tried setting a Before Launch action to run that Build Target, with the same failure as a result. This ONLY occurs when I try to build and run in the same target.
It seems like IntelliJ is caching the build state BEFORE anything runs and then using that same state AFTER the Maven Build has run... Does anyone know why this occurs and if there is a way to fix it, or am I just stuck running it twice after every clean? Happy to provide more detail if required.
Background as to why I want to do it one step: I'm setting this up for some very junior (and VERY prone to messing things up) devs and the fewer steps there are, the better. I don't want them to have to think about how to make it run.
As suggested by tgdavies in a comment, it's possible to make this work first time by adding an IntelliJ Build task following the Maven Build task in the Before launch steps. My Main Run Target now has Before launch: 1. Run Maven Goal 'Project Name: compiler:compile' 2. Build. Obviously this solution is less than ideal but at this stage, I'll take functional. I'll be raising a ticket with IntelliJ and hopefully it will be addressed... Thanks tgdavies!
I have a large mostly-Java multi-project Gradle build that I have opened in IntelliJ IDEA. This was imported correctly (as far as I can tell). One of the projects inside this is an old-school Java Swing GUI application.
When I attempt to run its main class from within IntelliJ using the "Run Main.main()" context menu, IntelliJ launches a Gradle task ":folder:project:Main.main()", which fails because of course there is no task in this project's build.gradle called "Main.main()".
The exact error looks like:
Execution failed for task ':folder:project:Main.main()'.
> A problem occurred starting process 'command 'C:/path/to/ojdk8/bin/java.exe''
What exactly am I expected to put into my build.gradle to get this to work?
As a secondary question, is it possible to make such a task agnostic over the actual main()-method containing class? This project contains several such classes that expose different functionality.
For context, I am a long-time Eclipse user evaluating IntelliJ for my organization. This is on IntelliJ IDEA 2022.1, Gradle 5.6.4, OpenJDK 1.8.0_275
I feel like I am missing something completely obvious, but I could not find the answer with any web searching or reading the IntelliJ documentation.
My mental model of what was happening was wrong. No specific Gradle tasks are required.
It turns out the root cause was Windows. When re-running the task with --stacktrace option I was able to see the actual error, which turned out to be:
CreateProcess error=206: The filename or extension is too long
Googling with this info I found this previous Stackoverflow question. Its answered got me onto the "Shorten command line" flag in the Run/Debug configuration. Setting this to "JAR manifest" solved the problem.
I'm looking for an IntelliJ IDEA plugin that would run my tests each time I change my code. I looked for such a solution and I found:
Infinitest, which works, but is inconvenient because I need to add the facet to each module, and it opens a new tool window for each module (which means 15 tool windows for me).
Fireworks - didn't work for me, maybe it just doesn't work with IDEA 14 (in its repo I can see that last changes were made in 2009). IntelliJ also reports that it throws exceptions.
There are lots of ways I could run all my tests (including writing a simple script for this), but I'm looking for a tool that would be smart enough to rerun failed tests first, and that would understand module dependencies (so after a change in some module it would run only tests of dependent modules).
I prefer free options, but if there's something paid for a reasonable price, I would accept it as well.
IntelliJ now actually has a Toggle auto-testin the run dialog. Just run a run-configuration and then select Toggle auto-testin the run dialog.
It's not as intelligent as you would have hoped. It just reruns when it detects changes.
I know this is a 3-year-old question but I think it will help people who face the similar problem in future. So I found out a way to enable SBT style auto test execution in IntelliJ studio.
We need to do 2 things to enable auto test execution.
Enabling auto project build - This can be done in settings by going into File -> Settings -> Build, Execution... -> Compiler and selecting "Build Project automatically".
Enabling "Toggle auto-test" in run dialog box
This will start auto testing. Although this works fine, it takes time to build the project even when my project is tiny so for larger projects it will certainly take very long time to complete the build and execute tests.
Reference: Original article which explains these steps
If you are OK running tests which cover a single method chosen by you, you can try this plugin (it is continuos in the sense that you make changes to a method, then click on the method and the plugin will run all the unit tests automatically which cover that method): https://plugins.jetbrains.com/plugin/15063-unit-test-coverage-history-runner
You can use the Intellij Teamcity plugin. Teamcity is a paid product but there is a free version which gives you 20 projects and 3 agents for free .
It has a remote run feature using which you can send in unchecked code to run tests before committing.
It also has options to run failed tests first
Usage instructions for Remote Run
I have an existing project in Eclipse (let's call it "NotPlayProj") which has a lot of java code still under development. I made a new eclipse project using play 2.1.0 (let's call it "PlayProj"). My goal is to use code from NotPlayProj in PlayProj and have both Eclipse and the Play compiler notice changes in either project.
If I go into the properties for PlayProj and add NotPlayProj via the Project tab, then method completion and inclusion works within eclipse, but the Play compile doesn't see the result. I've looked at Play modules and those don't seem to do what I want.
Is there any way to do this, ideally without modifying the NotPlayProj?
Edit ---
I've looked at http://www.playframework.com/documentation/2.0/SBTDependencies which shows how to export a jar from NotPlayProj into the PlayProj/lib directory, but this requires a manual export for each time NotPlayProject changes. I suspect that the Managed dependency section is supposed to cover this, but I've never used SBT before and am therefore probably missing something basic.
What you need is continuous integration.
Have a look at Jenkins: http://jenkins-ci.org/
You should setup a Continuous integration server and customize the builds you need.
Example:
You have your PlayProj running in some server, it needs to be able to use some of the latest classes from the other project called NoPlayProj.
Rebuild is a must, things such as downtime zero are difficult to achieve(At least I don't think this is what you are asking for either).
The steps you need to automate with Jenkins are:
1 - Build and deploy the latest version of NoPlayProj which is located in some repositorium
2 - Build and deploy the latest version of PlayProj which is located in some repositorium and also is contains your last commit where you updated the dependency that exist with NoPlayProj
A not very complex build and deployment instructions can be configured in Jenkins. This should speed you up a bit.
Also another suggestion would be to mavenize both projects if possible, this will help you manage the dependencies easier.
Just to clarify one thing, you said: My goal is to use code from NotPlayProj in PlayProj and have both Eclipse and the Play compiler notice changes in either project.
Well the order in which you execute the builds will be dependent in what you want to do as long as you update the dependency before you commit the code.
One last thing, if you don't want to deploy you don't have to do so you can create the Jenkins jobs, in such ways that you only build. With Jenkins you can do a lot of stuff, also you could execute some help scripts of your own that can provide you additional functionality.
I hope this was useful.
To let Eclipse see changes in NotPlayProj when working with PlayProj, it's enough to change configuration of PlayProj. Properties-> Java build path -> Projects -> Add NotPlayProj as dependency.
There is no straightforward way to let Play compiler handle dependencies, until you package it as jar. Consider configuration of simple ant task (External tools configuration -> Ant build ), which will copy your jar file. Task can be triggered by pressing the key or button.
With managed dependencies, every time you made change in NotPlayProj, you have to manually rebuild it. To let Ivy/Maven put dependency in your local repository. After that Play will take latest snapshot from your local repository.
Both approaches requires some efforts. Maybe you can take a look at Python scripts, which run Play, maybe it's enough to extend classpath with NotPlayProj when executing play start
Though I've never used the play framework, I would think that there is a format that both the play framework and eclipse understand and that is Maven. Look at http://www.playframework.com/modules/maven-head/home
I'm currently using ANT for building my Java project on a Windows XP machine.
In my build.xml file I've defined 3 task and I would like that,in case of fail,a default task be executed before closing the building and exiting (like a recovery procedure). I would like to know if it's possible.
thanks
Googled and found this. It's basically a try/catch for Ant. Might be worth a look: http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html
Never heard of such a property/task, but the follwing just comes to my mind: you could use an additional 'Master' ant script.
The master script (a new one) includes all public targets from the original one and delegates the work to the corresponding task in your build script (ant calls)
If the delegate fails, the master should be able to recognize the failure and could call the 'clean-up' task (either on the 'master' or on the original build file)