Hello,
I am using the Maven Project jar 2.1.0.
I get the following exception when I use it:
Exception in thread "main" java.lang.NullPointerException
at
org
.apache
.maven.project.ProjectUtils.buildArtifactRepository(ProjectUtils.java:
115)
at
org
.apache
.maven
.project.ProjectUtils.buildArtifactRepositories(ProjectUtils.java:56)
at
org
.apache
.maven
.project
.DefaultMavenProjectBuilder
.buildArtifactRepositories(DefaultMavenProjectBuilder.java:951)
at
org
.apache
.maven
.project
.DefaultMavenProjectBuilder
.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
at
org
.apache
.maven
.project
.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:227)
at
org
.apache
.maven
.project
.DefaultMavenProjectBuilder
.buildWithDependencies(DefaultMavenProjectBuilder.java:357)
at
org
.apache
.maven
.project
.DefaultMavenProjectBuilder
.buildWithDependencies(DefaultMavenProjectBuilder.java:345)
at
torque
.tasks
.TestJDBCtoXMLTransformationTask
.test(TestJDBCtoXMLTransformationTask.java:47)
at
torque
.tasks
.TestJDBCtoXMLTransformationTask
.main(TestJDBCtoXMLTransformationTask.java:80)
I see in the source code of DefaultMavenProjectBuilder.java, the
private member
private ArtifactRepositoryFactory artifactRepositoryFactory;
is never initialized. Hence resulting in the above mentioned NPE.
Can anyone point me how to resolve this issue?
I am using the Maven2 plugin of Torque project from Apache DB project
in my application as given below:
MavenProjectBuilder builder = (MavenProjectBuilder)
lookup(MavenProjectBuilder.ROLE);
ArtifactRepositoryLayout localRepositoryLayout
= (ArtifactRepositoryLayout) lookup(
ArtifactRepositoryLayout.ROLE,
"default");
ArtifactRepository localRepository
= new DefaultArtifactRepository(
"local",
"file://" + getBasedir() + File.separator
+ "target/test-classes/repository",
localRepositoryLayout);
MavenProject mavenProject = builder.buildWithDependencies(
new File(
getBasedir(),
"target/test-classes/projects/
TestJDBCtoXMLTransformationTask/pom.xml"),
localRepository,
null);
Thank you in advance,
Regards,
Amar