Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347623 - Null pointer exception when importing a maven project
Summary: Null pointer exception when importing a maven project
Status: CLOSED DUPLICATE of bug 340285
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-30 06:28 EDT by Xavi Beumala CLA
Modified: 2021-04-19 13:22 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavi Beumala CLA 2011-05-30 06:28:35 EDT
When importing a project using the pom file below I get the RTE below.


The problem is due to the version for maven-compiler-plugin is null. Adding this fixes the problem.
<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.3.2</version>
</plugin>


See more details on this discussion:
http://dev.eclipse.org/mhonarc/lists/m2e-users/msg00611.html


//-------------
// pom.xml
//-------------
<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>test</groupId>
  <artifactId>TestProject</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>New Test Project</name>
  <packaging>content-package</packaging>
     
  <build>
  	<plugins>
  		<plugin>
  			<groupId>com.day.jcr.vault</groupId>
  			<artifactId>maven-vault-plugin</artifactId>
  			<version>0.0.7</version>
  			<extensions>true</extensions>
  		</plugin>
  	</plugins>
  </build>
</project>



//-------------------------
// RTE
//-------------------------
An internal error occurred during: "Importing Maven projects".

java.lang.NullPointerException
	at org.apache.maven.plugin.DefaultPluginDescriptorCache$CacheKey.<init>(DefaultPluginDescriptorCache.java:164)
	at org.apache.maven.plugin.DefaultPluginDescriptorCache.createKey(DefaultPluginDescriptorCache.java:62)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:130)
	at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:251)
	at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:197)
	at org.maven.ide.eclipse.internal.embedder.MavenImpl.getMojoParameterValue(MavenImpl.java:765)
	at org.maven.ide.eclipse.jdt.internal.AbstractJavaProjectConfigurator.getCompilerLevel(AbstractJavaProjectConfigurator.java:399)
	at org.maven.ide.eclipse.jdt.internal.AbstractJavaProjectConfigurator.addJavaProjectOptions(AbstractJavaProjectConfigurator.java:370)
	at org.maven.ide.eclipse.jdt.internal.AbstractJavaProjectConfigurator.configure(AbstractJavaProjectConfigurator.java:95)
	at org.maven.ide.eclipse.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:57)
	at org.maven.ide.eclipse.internal.project.GenericLifecycleMapping.configure(GenericLifecycleMapping.java:48)
	at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:306)
	at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.configureNewMavenProject(ProjectConfigurationManager.java:240)
	at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:146)
	at org.maven.ide.eclipse.wizards.MavenImportWizard$1.runInWorkspace(MavenImportWizard.java:94)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Anders Hammar CLA 2011-05-30 06:35:39 EDT
I don't think Xavi's fix is a solution as it would add a compiler plugin binding. m2e should not have a requirement on some specific plugin's being bound.

This reminds me that there are no ITs testing this specific case for the code getting the character encoding from the compiler plugin and the resources plugin. I believe that code handles null (based on my memory), but there should be ITs to prevent any future regression if the code is changed.
Comment 2 Igor Fedorenko CLA 2011-05-30 07:43:45 EDT
The problem should be fixed in 0.13 for long time now. If you still see the problem with 0.13 RC2 or newer builds (available from eclipse as part of 3.7/Indigo) please reopen the bug and attach complete standalone project we can use to reproduce the problem. Do not use proprietary maven plugins in the sample project as we have no way to access them.

@Anders in m2e project configuration is fully based on actual project lifecycle. Specifically, it will not apply JavaProjectConfigurator for projects that do not use maven-compiler-plugin, for example.

*** This bug has been marked as a duplicate of bug 340285 ***
Comment 3 Denis Roy CLA 2021-04-19 13:22:46 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/