MyEclipse Logo
 

Maven4MyEclipse Tips

download the latest MyEclipse version

help and support
 

How to fix the 'Add JDK' warning

When working with Maven4MyEclipse for the first time, you might execute a Maven operation that requires a full JDK (as opposed to just a JRE) to run. When that happens you may get a JDK Warning like below:

If you see this dialog, you can click the "Maven JDK" link to jump directly to the configuration screen where you can set a JDK for Maven to use:

If you already have some JDKs configured (under Window > Preferences > Java > Installed JREs) you can select them using the dropdown, or click the Add... button to popup the Add JVM dialog to add a new one:

If you choose to add a new JDK, it's as easy as selecting the JDK's home/install directly and Eclipse will fill out the remaining information for you automatically. After you are done hit OK, then the Maven JDK will be updated for you:

You shouldn't have to set this property again, and if Maven should need to use a JDK, it will use the one you have now set.


 

How to interpret the 'No JAR' or 'Missing artifact' errors

In some cases, it is possible to add an unresolved dependency to your project using Maven4MyEclipse that doesn't exist in the remote Maven repository or your local Maven repository:

If those dependencies cannot be resolved from the local or remote repositories you will get a validation error on your pom.xml file as well as a build failure on your project for the missing artifact required to build the project successfully:

When this happens you have two choices:

  1. Import the resource into your local repository so it can be resolved (for instructions on how to do this, please see the next section).
  2. Remove the broken dependency and add a valid dependency in it's place.

In the case of #2, we added the following broken dependency:

The fix is to manually edit the pom.xml file and remove the <dependency> tag that contains the broken reference, then re-add the working dependency. In this case, we want to re-add springframework (the 6th item listed in the screenshot above) instead, and it will resolve.

There may be times where trial-and-error are required to determine which references are resolving and which aren't if you run into this problem. Over time we will continually refine the catalog index to make it more accurate and remove unresolving dependencies for you. We just wanted to provide a tip on how to get out of this situation incase you ever find yourself there.


How to install your own JARs into a Maven repository

One of the most powerful and unique features in Maven4MyEclipse is the abillity to import JARs directly into the remote repository by way of a wizard.

You can access the Import JAR wizard by going to File > Import:

or by going to the MyEclipse > Utilities > Maven4MyEclipse menu:

You then select the JAR you want to import into your repository and enter in the appropriate Group Id (approximately a parent package if you want to think of it that way) and an Artifact Id (approximately a specific project package) then provide a Version and hit Finish to import that JAR into your repository:

Once a JAR has been imported into the repository, you are free to add it as a Dependency to any other projects that want to make use of it, and Maven4MyEclipse will resolve it correctly for you.


How to run 'Site' for generating project status report resources

Maven provides the ability to generate a large number of "reports" for your projects; including but not limited to: CheckStyle reports, Code Coverage reports, Code Dependency reports, PMD/Code Violation reports and more. In order to get reports generated for your project this is typcially done by adding the appropriate set of plugins and parameters for those plugins to the reporting portion of your pom.xml file.

Below is an example (please adjust/change to fit your needs) of a reporting portion that you can copy-paste into your pom.xml right after the dependencies closing tag to have Maven generate site reporting for you (when running the site goal):

	<reporting> 
		<plugins> 
			<plugin> 
				<groupId>org.codehaus.mojo</groupId> 
				<artifactId>cobertura-maven-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId>maven-surefire-report-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId>maven-javadoc-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId> 
					maven-project-info-reports-plugin 
				</artifactId> 
				<reportSets> 
					<reportSet> 
						<reports> 
							<report>summary</report> 
							<report>dependencies</report> 
							<report>project-team</report> 
						</reports> 
					</reportSet> 
				</reportSets> 
			</plugin> 
			<plugin> 
				<groupId>org.codehaus.mojo</groupId> 
				<artifactId>jxr-maven-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId>maven-surefire-report-plugin</artifactId> 
				<version>2.4.2</version> 
			</plugin> 
			<plugin> 
				<artifactId>maven-clover-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId>maven-pmd-plugin</artifactId> 
				<configuration> 
					<targetjdk>1.5</targetjdk> 
					<rulesets> 
						<ruleset>/rulesets/basic.xml</ruleset> 
						<ruleset>/rulesets/controversial.xml</ruleset> 
					</rulesets> 
					<format>xml</format> 
					<linkXref>true</linkXref> 
					<sourceEncoding>utf-8</sourceEncoding> 
					<minimumTokens>100</minimumTokens> 
				</configuration> 
			</plugin> 
			<plugin> 
				<groupId>org.apache.maven.plugins</groupId> 
				<artifactId>maven-checkstyle-plugin</artifactId> 
			</plugin> 
			<plugin> 
				<groupId>org.codehaus.mojo</groupId> 
				<artifactId>jdepend-maven-plugin</artifactId> 
			</plugin> 
		</plugins> 
	</reporting> 
	<developers> 
		<developer> 
			<id>sally</id> 
			<name>Sally Serena</name> 
			<email>sally.serena@mycompany.com</email> 
			<roles> 
				<role>Developer</role> 
			</roles> 
			<organization>My Great Company</organization> 
		</developer> 
		<developer> 
			<id>micky</id> 
			<name>Micky Mango</name> 
			<email>micky.mango@mycompany.com</email> 
			<roles> 
				<role>Developer</role> 
			</roles> 
			<organization>My Great Company</organization> 
		</developer> 
	</developers> 
	<contributors> 
		<contributor> 
			<name>Jerry Jacobson</name> 
			<email>Jerry.Jacobsen@mycompany.com.com</email> 
			<roles> 
				<role>Management Represented</role> 
			</roles> 
		</contributor> 
	</contributors>