We have the following project setup: Maven, Eclipse, Subversion. Eclipse Launch configurations are in a separate docs folder next to the pom.xml. The launch configurations run something like mvn clean install -Pdev or mvn tomee:run -pl something-ear
The good thing is that a shared run configuration is picked up by the IDE and shown in the External Tools run commands. This way, every developer that checks out this project immediately has access to run the build.
We would like to have something similar using IntelliJ IDEA, but I haven't found a good equivalent. What I have considered so far:
Share run scripts
My first idea was to replace the launch configurations with run scripts. I just could not figure out how to have those run scripts run inside IntelliJ IDEA just the way a Maven goal would be executed.
Share IDEA project configuration
The IDEA project configuration (specifically .idea/runConfigurations) inside the checked out directory is not a good solution. We have (speaking one IDEA project with different IDEA modules depending on the task at hand: as a developer you might need multiple IDEA modules (and sub-modules) in the same IDEA project
An IDEA project consisting of the following modules is not something unusal
projectA/trunk
projectB/tags/1.2
projectC/branches/some-change
My preferred solution would remove all IDE-specific configuration from the repository and have some kind of run definitions either in the project folder or a folder next to the pom.xml that a developer can run from the command line or from her IDE of choice.
The optimal solution would let me define something like this in the pom:
<runConfigs>
<default>clean install</default>
<container>tomee:run -pl something-ear</container>
</runConfigs>
This configuration would then be picked up by the IDE and provided as a run or launch configuration to the developer.
Any ideas or suggestions?
Thank you very much!
My current approach is a hybrid solution:
No configuration in the separate modules
One IDEA project configuration with run configurations managed in VCS
The .idea/runConfigurations directory is versioned separately from the project sources. It contains commands with a working directory set relative to the PROJECT_DIR:
<MavenRunnerParameters>
…
<option name="workingDirPath" value="$PROJECT_DIR$/path/to/submodule" />
</MavenRunnerParameters>
When setting up a new project, the developer also checks out this folder and has a set of pre-configured launch configurations for all projects. The downsides are
All launch configurations are managed centrally instead of with the module
The IDEA project directory has a fixed location relative to the modules. If you set up another project, you will have to change the run configurations
The setup does not clearly state how changes to the launch configurations are shared with other developers
Related
At my job we use gradle, so on my laptop I have a ~/.gradle/init.d folder which contains the init scripts that define our enterprise-wide configuration, such as the URL of the local repository, docker publishing rules, checkstyle rules, etc.
I want to use gradle for a personal project, so I don't want to use any of these init scripts. Here are the ideas I have come up with so far:
Rename ~/.gradle to ~/.gradle-work, create ~/.gradle-personal, and then symlink ~/.gradle to -work or -personal depending on what I'm doing.
Have ~/.gradle as my personal gradle settings, and create another gradle folder ~/dev/work/.gradle with all my work init scripts. Make sure $GRADLE_HOME is set to ~/dev/work/.gradle when running gradle for any work projects.
Some variant of 2 where gradle will automatically use ~/dev/work/.gradle if it detects that the project is in the ~/dev/work/ folder.
Option 1 feels quite clumsy. Option 2 feels very tedious to have to set or unset an environment variable whenever I want to use gradle. Ideally I would like something like option 3 where I don't have to do any fiddling around whenever I change between personal or work projects. Is this possible? Or is there another solution that could solve my problem?
The keyword is too verbose to help me find anything useful. Please pardon me if it's a stupid question.
I have two spring-boot projects, A and B, in the same directory. I run
mvn clean
mvn compile
mvn package
mvn spring-boot:run
in the directory of project A and want to run A. However, the pages of project B shows up (both of them use localhost:8080).
I tried the following but none worked:
Moved and renamed A to another directory and ran all the above commends again;
Clean brower cache or open in incog window;
Remove .m2 folder;
Reboot my laptop;
Run with IDE, mvn spring-boot:run, and java -jar target/ProjectA.jar;
Invalidate Cache/Restart in IntelliJ.
Also:
If I break Project A (make it fail to compile), mvn compile will fail;
If I break Project B, running A will still give me B;
If I change the contents of html files in B, it won't change the showing pages;
If I debug the project A, it will hit the main function in #SpringBootApplication;
Everything is running on Win10, no container or VM.
It seems I am running Project A, but it has neither MvcConfig nor html templates, where are those pages from? I did a thorough search for page contents, but the project directory of A didn't contain anything like that. So it must from somewhere else.
Github: https://github.com/PhoenixPan/finishthem-api-server
(doesn't have any visible html page)
Hope someone could explain why this is happening and how should I prevent it... Thanks.
Have you tried running your project A from your IDE as a simple java application? You can run a Spring Boot application from your IDE as a simple Java application. However, you first need to import your project. Import steps vary depending on your IDE and build system. Most IDEs can import Maven projects directly. For example, Eclipse users can select Import… → Existing Maven Projects from the File menu.
Would like to disable the test-out folder means test outputs in my project as it less disk space issues in automation machines. Tried all below options as got it our tool:
SetDefaultListener(false);
setVerbose(0);
command line argument -usedefaultListener false
nothing can work me.I am using maven build tool to generate the jar. We need to give the jar to automachines to run this.
That's not possible by definition if do not want to have that folders, you have to skip tests in process of Jar building.
I currently have a SoapUI project which I intend to have executed periodically (every 5 minutes) in Jenkins. I've completed the following thus far:
Created the relevant directory in the Workspace i.e workspace\SOA\SOAProject\src\test\soapui\SoapUIProject.xml
I've configured a pom.xml which sits in the SOAProject folder alongside the src folder
I've created a Jenkins job (I've chosen a Maven project, although it should not be an issue if I had chosen a freestyle job)
My question is, how do I set the endpoint?
I've done the following...
Build
**Root POM** pom.xml
Goals and options
testrunner.bat -e0.00.0.006:8040
Edit:
I've installed the EnvInject plugin. I'm not sure how to create the /properties file and what to put in their in order to set the execution environment?
I don't know the answer, but my suggestion is to get it running via command-line first. Once you figure out how to launch it without Jenkins, having Jenkins issue the same command because easy.
If you choose a Maven project, there is a useful plugin to set the endpoint and different propeties for the testSuites...
https://github.com/redfish4ktc/maven-soapui-extension-plugin
I have created a maven vaadin project using the command line like this:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.9
Then I change into the folder of the application and I give at the command line the following :
mvn install
After waiting for the application to compile, I open it using IntelliJ Idea (by opening the pom.xml file), I add Tomcat Server and I press run.
Then the IntelliJ Ide recompiles the application again.
Is there any way I can avoid this second compilation?
Thank you.
You should have tomcat configured as a server, and configure your module(s) to deploy at server startup. On the run configuration you will see a list of things to do before launch. It will probably say Make -- you can remove this if you need to.
However, you probably should allow idea to do this for you and really stop doing it on the command line. Idea can handle more complex build patterns for you. You should trust it.