我正在尝试使用maven执行我的加速项目。我已将所有依赖项包含在pom文件中。它成功编译(使用命令包)。这是我的pom文件:
<plugin>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>maven</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<useBinaryResources>false</useBinaryResources>
<usePlatformResourcePath>true</usePlatformResourcePath>
<acceleoProject>
<root>${project.basedir}</root>
<entries>
<entry>
<input>src/main/java</input>
<output>target/classes</output>
</entry>
</entries>
</acceleoProject>
<packagesToRegister>
<packageToRegister>org.eclipse.uml2.uml.UMLPackage</packageToRegister>
</packagesToRegister>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>src.AcceleoProject.files.Generate</mainClass>
<arguments>
<argument>/${project.basedir}/src/main/java/src/AcceleoProject/files/model.uml</argument>
<argument>/${project.basedir}/src/main/java/src/AcceleoProject/files</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>maven</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>model</artifactId>
<version>3.1.3.v20120214-0359</version>
</dependency>
<dependency>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>engine</artifactId>
<version>3.1.3.v20120214-0359</version>
</dependency>
<dependency>
<groupId>org.eclipse.acceleo</groupId>
<artifactId>common</artifactId>
<version>3.2.0.v20111027-0537</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>common</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>resources</artifactId>
<version>3.7.101.v20120125-1505</version>
</dependency>
<dependency>
<groupId>org.eclipse.uml2</groupId>
<artifactId>uml</artifactId>
<version>3.2.100.v201108110105</version>
</dependency>
<dependency>
<groupId>org.eclipse.uml2</groupId>
<artifactId>common</artifactId>
<version>1.6.0.v201105021727</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
<version>3.7.2.v20120110-1415</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>contenttype</artifactId>
<version>3.4.100.v20110423-0524</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>runtime</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf.ecore</groupId>
<artifactId>xmi</artifactId>
<version>2.7.0.v20120127-1122</version>
</dependency>
<dependency>
<groupId>org.eclipse.ocl</groupId>
<artifactId>ecore</artifactId>
<version>3.1.2.v20111015-2027</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>ocl</artifactId>
<version>3.1.0.v20120206-0606</version>
</dependency>
<dependency>
<groupId>lpg.runtime</groupId>
<artifactId>java</artifactId>
<version>v201004271640</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>common</artifactId>
<version>3.3.0-v20070522</version>
</dependency>
</dependencies>
</project>
我发出命令后:exec:java我收到此错误:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project AcceleoProject: An exception occured while executing the Java class. null: InvocationTargetException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project AcceleoProject: An exception occured while executing the Java class. null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at org.eclipse.core.internal.runtime.InternalPlatform.getBundle(InternalPlatform.java:861)
at org.eclipse.core.runtime.Platform.getBundle(Platform.java:1185)
at org.eclipse.acceleo.common.internal.utils.workspace.BundleURLConverter.resolveBundle(BundleURLConverter.java:186)
at org.eclipse.acceleo.common.internal.utils.workspace.BundleURLConverter.resolveAsPlatformPlugin(BundleURLConverter.java:137)
at org.eclipse.acceleo.engine.internal.environment.AcceleoEvaluationEnvironment.loadDynamicModules(AcceleoEvaluationEnvironment.java:763)
at org.eclipse.acceleo.engine.internal.environment.AcceleoEvaluationEnvironment.mapDynamicOverrides(AcceleoEvaluationEnvironment.java:899)
at org.eclipse.acceleo.engine.internal.environment.AcceleoEvaluationEnvironment.<init>(AcceleoEvaluationEnvironment.java:139)
at org.eclipse.acceleo.engine.internal.environment.AcceleoEnvironmentFactory.createEvaluationEnvironment(AcceleoEnvironmentFactory.java:124)
at org.eclipse.ocl.internal.evaluation.QueryImpl.getEvaluationEnvironment(QueryImpl.java:286)
at org.eclipse.ocl.ecore.QueryImpl.getEvaluationEnvironment(QueryImpl.java:74)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:268)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:145)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:869)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:575)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:188)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:158)
at src.AcceleoProject.files.Generate.doGenerate(Generate.java:197)
at src.AcceleoProject.files.Generate.main(Generate.java:159)
... 6 more
任何想法,它可能有什么问题?
提前谢谢你 ME