`
crazy_stone
  • 浏览: 1323 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

maven-site-plugin和 maven-scr-plugin同时使用时site plugin不能删除target中OSGI-INF\serviceCo

阅读更多
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default) on proj
ect org.wso2.carbon.registry.core: failed to get report for org.apache.maven.plugins:maven-javadoc-p
lugin: Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (auto-clean) o
n project org.wso2.carbon.registry.core: Failed to clean project: Failed to delete D:\wso2carbon-3.2
.2-src\core\org.wso2.carbon.registry.core\3.2.0\target\scr-plugin-generated\OSGI-INF\serviceComponen
ts.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plug
ins:maven-site-plugin:3.0:site (default) on project org.wso2.carbon.registry.core: failed to get rep
ort for org.apache.maven.plugins:maven-javadoc-plugin
        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(LifecycleModuleBu
ilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBu
ilder.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:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        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:597)
        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: failed to get report for org.apache.maven
.plugins:maven-javadoc-plugin
        at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildMavenReports(DefaultMaven
ReportExecutor.java:154)
        at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.getReports(AbstractSiteRenderingM
ojo.java:240)
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:121)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.j
ava:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache
.maven.plugins:maven-clean-plugin:2.4.1:clean (auto-clean) on project org.wso2.carbon.registry.core:
Failed to clean project: Failed to delete D:\wso2carbon-3.2.2-src\core\org.wso2.carbon.registry.cor
e\3.2.0\target\scr-plugin-generated\OSGI-INF\serviceComponents.xml
        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.MojoExecutor.executeForkedExecutions(MojoExecutor.jav
a:365)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeForkedExecutions(DefaultLifecy
cleExecutor.java:173)
        at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildReportPlugin(DefaultMaven
ReportExecutor.java:282)
        at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildMavenReports(DefaultMaven
ReportExecutor.java:148)
        ... 23 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to clean project: Failed to delete
D:\wso2carbon-3.2.2-src\core\org.wso2.carbon.registry.core\3.2.0\target\scr-plugin-generated\OSGI-I
NF\serviceComponents.xml
        at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:188)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.j
ava:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 29 more
Caused by: java.io.IOException: Failed to delete D:\wso2carbon-3.2.2-src\core\org.wso2.carbon.regist
ry.core\3.2.0\target\scr-plugin-generated\OSGI-INF\serviceComponents.xml
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:227)
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:186)
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:154)
        at org.apache.maven.plugin.clean.Cleaner.delete(Cleaner.java:115)
        at org.apache.maven.plugin.clean.CleanMojo.execute(CleanMojo.java:168)
        ... 31 more
[ERROR]

<groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>

。。。。。。。。。。。。。。。。。。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <executions>
                    <execution>
                        <!--<phase>install</phase> -->
                        <phase>package</phase>
                        <goals>
                            <goal>site</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

两个插件同时在package阶段同时使用,会存在site不能删除serviceComponen
ts.xml 的可能性,时有可能出现。存在scr 1.0.10和1.14.0版本上,甚至1.14.0版本以下都存在此问题。

1.15版本因为其插件大幅改动,使用OSGI的 buildContext输出,不知道是否存在[未测试]。



原因:

scr  plugin输出流没有手动关闭,导致程序运行时自动关闭效果不理想。



解决方案:

一是,更改scr  plugin的输出,或site 输出。

例如

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
              <configuration>
                        <outputDirectory>${project.build.directory}/../target2/</outputDirectory>
                  </configuration>
   </plugin>

二是,修改scr插件代码,关闭文件输出流


具体修改的src-plugin 1.0.
参看附件
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics