Problem
Since yesterday, I am unable to launch a proper debug of my tests. Debugger happily jumps over my breakpoints. I validated that the code was actually executed by adding some logs.
What I've tried so far
Synchronize project
Clean, reinstall and rebuild the project
Purge Maven dependencies
Upgrade IntelliJ IDEA to the last version
Read IntelliJ docs about configuring debugger options
Browse questions that had been asked before, with no success (for instance here, here and here).
More info about the project
The executed Java code is in one of the folders declared as test sources (one is "java" for Selenium tests, other is "scala" for Gatling tests).
My Maven command line is pretty straightforward: package clean -Dtest=MyTestClass integration-test.
EDIT: My POM configuration does mention reuseForks and forkCount. I've also tried playing with deprecated forkMode, but with no success.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<forkCount>0</forkCount>
<disableXmlReport>false</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
What is funny, though: debugger actually stops at breakpoints when I right-click on the project root or on test sources root ("java" folder) and click on "Debug 'All tests'".
Any help... will help.
If you are using surefire plugin it runs your test in another process hence you are not able to debug.
Use forkMode=never in your maven configuration
I have maven plugin installed for my eclipse of version (Oxygen).
I have the following added to my pom.xml -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
I can go to my project and click Maven -> Update Project and it updates it.
Still it is not treated as a java project though. When I am trying add a new package or a class, I get the error "Source folder is not a Java project.". Could someone please provide me pointers? Appreciate any help in advance!
You can first create a java project and right-click the project at Package-Explorer view, select Configure>Convert to Maven Project, then you can use maven dependency.
I have a maven project that is going out to tomcat using a exploded war build in development. I have the following entry in my pom to exclude certain files for any non development environments:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
<webXml>web/WEB-INF/web.xml</webXml>
<packagingExcludes>
WEB-INF/classes/application.properties,
WEB-INF/classes/proxool.xml,
WEB-INF/classes/log4j.properties,
WEB-INF/classes/wetemplates/**
</packagingExcludes>
</configuration>
</plugin>
The packaging excludes are being used by intellij and excluded from my local development build and breaking it. I have been having to comment this block out in development for the environment to function correctly. How can I resolve this so that these are not excluded in my development environment?
You can use maven profiles to configure the build in such way that the Intellij build will use one given profile and the Maven/external build will use another profile.
Take a look at here: http://maven.apache.org/guides/introduction/introduction-to-profiles.html
I am trying to create my first MuleSoft application using Maven. I have used CMD to confirm that both Java and Maven are installed. I've also configured my environment variables.
I then open the MuleSoft Anypoint Studio, and create my first named "mulesoft-sample" I select to use Maven, and leave all default settings as they are.
Once I click finish, the Console begins to download a number of files
These continue to be downloaded until after it would seem the near end of the files, it throws an error:
There was an error running the studio:studio goal on project mulesoft-sample
In Console, I see the errors listed below.
I was originally trying to use the latest version of Maven (3.5.0). However, I found a video tutorial that said 3.3.9 was a verified version for MuleSoft. So I thought perhaps the newest version wasn't supported and instead used 3.3.9. However, it is still failing. I've also tried changing the environment variable to other options, such as going straight to \bin, rather than the complete directory (taking shots in the dark here). Unfortunately, nothing has worked and I'm running out of option.
Can anyone tell me why I'm getting these errors, and my build will not succeed? How to correct the error?
In anypoint studio go on windows>prefernces.then click on java>installed JREs. and add your Java JDK folder and note that only JDK, not JRE. then you can test your maven
This error occurs when the right java is not pointing with Anypoint Studio . In the studio navigate to windows > preferences the search java. Make sure jdk is selected and not jre . If still problem continues try updating your java and reinstalling maven .
Download the latest maven on your local machine, then goto anypoint
studio windows->preferences->anypoint studio->maven
provide the maven path and click Test Maven configuration(green
check mark obtained if the URL is properly provided)
Mule Maven Plugin configuration.
1.1. Use mule mule-app-maven-plugin to build the application.
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-app-maven-plugin</artifactId>
<version>${mule.tools.version}</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>false</copyToAppsDirectory>
</configuration>
</plugin>
No need for additional Mule Maven plugins.
This is the default mule plugin set when creating your Mule project on AnyPoint (AP) Studio.
1.2. Make sure you set flag copyToAppsDirectory to false.
This flag is set to true by default so you must change it manually.
Maven Dependency Plugin Configuration.
2.1. Now we need to add a plugin to copy the generated artifact to the MULE_HOME/apps directory, i.e. to deploy the application to the standalone local mule server.
We will use the maven-dependency-plugin.
Just add these plugin after the mule maven plugin section in your application pom.xml.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>deploy</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mule.support.ba</groupId>
<artifactId>bonmarche-case-00145615</artifactId>
<version>1.0.0</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>C:/mule-home/apps</outputDirectory>
<destFileName>bonmarche-case.zip</destFileName>
</artifactItem>
</artifactItems>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
2.2. Update the attributes within the tag (in grey) with the corresponding values on your environment.
2.3. As you see in 2.1, we are configuring the deployment to apps folder on Maven 'deploy' phase. You may choose a different phase to copy the artifact, but it must be bound to any phase after the package phase, so that the artifact exists in the repository.
Disable the default execution of Maven Deploy Plugin to prevent deploying the generated artifact to an external repository. This may be changed depending on your project needs.
Add this plugin after maven-dependency-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
Build your application and verify the generated ZIP file is copied to MULE_HOME/apps directory.
$> mvn clean deploy
I have faced same issue and got resolved by changing the JRE to JDK in preferences==>java==>Installed JRE's there change to JDK and restarted the any point studio. This resolved the issue to me.
I can't run the Maven Netbeans JavaFX example :
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) onproject mavenproject3:
Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e
switch. Re-run Maven using the -X switch to enable full debug logging.
My POM looks like this :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.huw.almexoffice.client</groupId>
<artifactId>almex-office-client</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Almex Office Client</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.huw.almexoffice.client.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Does anyone know why this is happening?
And if not, does anyone know how to get Maven running with the -e or the -X switch via Netbeans? I assume it is via a right click on the POM and then run goal then entering something in the textfield there.
This error would spring up arbitrarily and caused quite a bit of trouble though the code on my end was solid.
I did the following :
I closed it on netbeans.
Then open the project by clicking "Open Project", selecting my project and
Simply hit the run button in netbeans.
I would not build or clean build it. Hope that helps you out.
I noticed another reason why this happens. If you moved your main class to another package, the same error springs up. In that case you :
Right Click Project > Properties > Run
Set the "Main Class" correctly by clicking "Browse" and selecting.
I faced the same issue. When I tried to run the project from IDE, it was giving me same error. But when I tried running from the command prompt, the project was running fine. So it came to me that there should be some issue with the settings that makes the program to Run from IDE.
I solved the problem by changing some Project settings. I traced the error and came to the following part in my pom.xml file.
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>${runfx.args}</commandlineArgs>
</configuration>
</execution>
I went to my Project Properties > Actions Categories > Action: Run Project:
then I Set Properties for Run Project Action as follows:
runfx.args=-jar "${project.build.directory}/${project.build.finalName}.jar"
Then, I rebuild the project and I was able to Run the Project. As you can see, the IDE(Netbeans in my case), was not able to find 'runfx.args' which is set in Project Properties.
what's happening? you haven' shown much of the output to be able to decide. if you are using netbeans 7.4, try disabling Compile on Save.
to enable debug output, either run Custom > Goals... action from project popup or after running a regular build, click the Rerun with options action from the output's toolbar
I am a beginner in Maven - don't know much about it.
Carefully check on your input i.e. file path in my case.
After I have carefully check, my file path is wrong so it leads to this error.
After I fixed it, it works magically lol.
A solution which worked in my case is:
1. Go to the module having Main class.
2. Right click on pom.xml under this module.
3. Select "Run Maven" -> "UpdateSnapshots"
Had the same problem, I worked around it by changing
${java.home}/../bin/javafxpackager
to
${java.home}/bin/javafxpackager
Had the same problem after installing oracle jdk on Ubuntu 13.10 x64.
I've done the following steps, not sure which one helped. I think that at least 2 and 3 are necessary.
Deleted Netbeans 7.4 and reinstalled it from oracle's site.
Installed plugins for maven, ant and java that may be related to the project.
Deleted .nbproject folder - after that the project was considered a maven project.
Also, after that, I've found that the project runs, but exits with exit code 1 because I didn't supply the command line parameters for it. And the builder considers it is an error. So, look carefully for the output and see if the program actually starts.
Maven needs to be able to access various Maven repositories in order to download artifacts to the local repository. If your local system is accessing the Internet through a proxy host, you might need to explicitly specify the proxy settings for Maven by editing the Maven settings.xml file. Maven builds ignore the IDE proxy settings that are set in the Options window.
For many common cases, just passing -Djava.net.useSystemProxies=true to Maven should suffice to download artifacts through the system's configured proxy. NetBeans 7.1 will offer to configure this flag for you if it detects a possible proxy problem. https://netbeans.org/bugzilla/show_bug.cgi?id=194916 has discussion.
I solved this issue with right click on project -> Set as Main Project.
Netbeans needs to be able to index the maven repository. Allow it to do that and try again. It was giving me the same error and after it indexed the repository it ran like a charm
Try to run Maven from the command line or type "-X" in the text field - you can't break anything this way, at the worst, you'll get an error (I don't have Netbeans; in Eclipse, there is a checkbox "Debug" for this).
When running with debug output enabled, you should see the paths which the exec-maven-plugin plugin uses.
The next step would then be to copy the command into a command prompt or terminal and execute it manually to see if you get a useful error message there.
Restart Netbeans & it solved my problem.
Im new to java hibernate but i could solve this problem, this is how i did it :
I was working with hibernate and maven project.
First you have to put persistence.xml under project directory, then add jdbc manually.
Maven couldn't download my dependency so i added it manually.
In the persistence.xml in design jdbc connection add it manually ps: i work with netbeans good luck
For me, the clue was the "org.codehaus.mojo:exec-maven-plugin:1.2.1:exec".
The only place this was referenced was in the "Run project" action under Project Properties=>Actions.
When I changed this action to match the HelloFXMLWithMaven sample project (available in Netbeans 11.1):
"clean javafx:run"
then executing the Run goal was able to proceed.
Note, I also had to update the pom file's javafx-maven-plugin to also match the sample project but with the mainClass changed for my project.
Rohith H.Y Solved this problem
I noticed another reason why this happens. If you moved your main class to another package, the same error springs up.
In that case you :
Right Click Project > Properties > Run
Set the "Main Class" correctly by clicking "Browse" and selecting.