I am building my jar abc.jar. At the same time I am also building the abc-sources.jar.
I am having a project xyz which is dependent on abc.jar. So I am adding abc.jar in the classpath. But when I am trying to debug and see the source code of abc.jar through reference libraries of xyz project I always get source not attached so I have to also include abc-sources.jar file in the classpath of xyz in order to debug through the source of abc.
I guess is there something wrong with my eclipse workspace or is there another way of compiling abc.jar to get the source code or is it that my eclipse needs another plugin?
Thanks!!
If you use m2e or m2eclipse, right-click the project and select Maven > Download Artifact Sources
Or activate it permanently by selecting Window > Preferences > Maven > Download Artifact Sources from the Menu Bar
If you use the maven-eclipse-plugin, do it like this:
mvn eclipse:eclipse -DdownloadSources=true
Related
In Eclipse Neon, I did an 'import existing maven project' from a local folder, whose content was copied from another machine. The project is not reading the dependencies on the POM file, and one example is the log4j dependency. A workaround is to add the log4j-1.2.17.jar manually to the project as an external jar, but this is wrong. Does anyone have tips on how to troubleshoot? I am fairly inexperienced with maven so I m not sure if there are additional settings or configuration that I have do when importing an existing project into eclipse.
You can make sure if your project dependencies are being pulled correctly or not by executing
mvn clean install
from within the project directory on the command line. This would download the required dependencies of the project as well.
The most common cause I have seen for this issue occurs whenever Maven encountered an error while downloading an artifact from a repository. In this case, Maven marks the download as failed and won't retry until some time elapses (I do not remember how long).
The easiest way to test this is to delete the .m2/repository folder in your home directory and let Maven download the artifacts again. If you have Maven installed you just execute "mvn install" from a console. Otherwise, you can try:
Right click the project in Eclipse
Select "Maven > Update Project"
Check "Force Update of Snapshots/Releases"
Click "OK"
The Apache Maven Eclipse Plugin is retired. What is the equivalent command line or in Eclipse UI for:
mvn eclipse:eclipse
that generates the files that a project requires to be seen as a Java project in Eclipse?
The eclipse goal of the maven-eclipse-plugin would actually:
generates the Eclipse configuration files.
Which basically means .project, .classpath and the .settings folder.
These folders and procedure is handled by the Import action, where you can actually specify to import an existing project as a Maven project:
Right click on the Projects view > Import > Import... The procedure will properly create the aforementioned files and configure Eclipse accordingly.
However, shall you already have the project imported (in that case files would already exist), you can convert the existing project to Maven via the Configure action:
A right click on the concerned project > Configure > Convert to Maven Nature would then modify the existing files and settings to recognize the Maven build (mostly adding the org.eclipse.m2e.core.maven2Nature nature and org.eclipse.m2e.core.maven2Builder information to the existing .project file).
I have an existing project that uses an Ant build.xml file to maintain the location of dependency jars.
In Eclipse it's very easy to import from an existing Ant file. I have searched online and looked through all of the "new project" options in IntelliJ but cannot figure out how to do this.
The closest thing I've done is File > New > Project from Existing Sources. But my whole project is full of errors because it didn't use the build.xml to include the jars.
Intellij supports Ant projects via built in Ant plugin which is included by default in IDE.
To check if it is enabled go to Settings > Plugins > Ant
After enabling plugin, you can use build.xml from View > Tool Windows > Ant Build
You should then have option(+) of importing your build.xml file.
Import the project "from existing sources" without choosing any build tool (ant is not on the list, only maven, sbt, etc...). Then after completing the import wizard, in the project files view, right click ant's build.xml file, and choose the option relating to ant which is hiding at the bottom of the menu.
You should use File > New > Module instead of File > New > Project from Existing Sources for Ant project. You also need to set your Content root and Module file location to your current Ant project directory.
You may also need to set right path to project output in Project Structure > Use module compile output path and set proper content route in Project Structure > Sources
Please, follow the steps below if you use the IntellIj:
Check the Ant plugin for the project.
select the build.xml file and add as the Ant build file
Use the side button to deploy the project
I get a mvn project , and to debug this project in eclipse,I imported the project into eclipse.But it's a pitty that some imported packages cannot be resolved by eclipse.Othes tell me that I should install m2eclipse plugin for eclipse, and run ""mvn eclipse:eclipse" to convert the project as a eclipse-like" project ,thus all packages will imported to eclipse build path automatically. Yes , I do so. And the eclipse build path is just like this
:
But it is extremely strange that eclipse still cannot resolve some import .
Any body can tell me what happened? From the build path ,I can see that eclipse have already imported the needed jar file for me.But it seems that the build path didn't take effect.
First of all, you're not using the m2e plugin; while it may be installed, it's not activated for this project:
There is no little "M" on the project's icon
The classpath doesn't include an entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
From what I can see, Eclipse can't resolve the dependencies since the variable M2_REPO isn't defined (if it could, you would see the absolute path to the JARs in the upper image after the symbolic path).
To fix this, go to Preferences and search for "Classpath Variables". Add M2_REPO there with the correct path (default is $HOME/.m2/repository).
If it already exists, make sure the path is correct.
Alternatively, right click on project and select "Convert to Maven Project" under "Configuration".
How did u create a project. Try creating a web project. This template will provide the correct creation web application structure. It will also automatically add the required jars in the build path.
It is an eclipse problem (are you using the latest version?), try to run:
mvn eclipse:clean
mvn eclipse:eclipse
then open eclipse, refresh the project (right click on the project icon and select refresh),
clean it (Project > clean ...). It could be necessary to reconvert the project to maven
(right click on the project and convert it to maven project).
Sometimes closing the project (right click on the project icon > close project) and reopening it (double click on the icon) solves this issue.
I've created gwt project using maven plugin:
mvn -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.1 -DgroupId=com.savdev.BasicGwtProject -DartifactId=BasicGwtProject -Dversion=1.0 org.apache.maven.plugins:maven-archetype-plugin:generate
Then I created a new IDEA projext using the generated pom.xml file. At the moment Project Compiler Output folder points to PrjectName/out, as usual I set it to ProjectName/target folder, to build project both with maven and IDEA, but when I ran maven install I haven't found class folder in the ProjectName/target directory. Where does the "Project Compiler Output" should point when mix IDEA, Maven for GWT project.
'Project Compiler Output' is used as a base directory for output paths for modules when IDEA project structure is created by hand. If a project is imported from Maven IDEA set output paths for modules individually accordingly to Maven configuration (see 'Paths' tab of a module editor in 'Project Structure' dialog) and 'Project Compiler Output' isn't used at all.