我有一个基于Maven的Netbeans应用程序。默认情况下,应用程序窗口标题采用以下格式:
<Application Name>{0}
在运行时将{0}替换为IDE构建日期。有没有办法让它自动成为项目的Maven版本?
现在我需要在每个版本上手动更改它。它只是容易出错。
更新 在POM中添加了以下内容,但看起来有点效果,Netbeans显示红色图标,因为找不到我在模块中使用的帮助集的某些文件。
<resources>
<resource>
<directory>${basedir}/src/main/nbm-branding/core/core.jar/org/netbeans/core/startup</directory>
<filtering>true</filtering>
</resource>
</resources>
答案 0 :(得分:0)
The easy way is to set the system property netbeans.buildnumber to some value in your application.
The harder way is to put this key/value currentVersion=My Product 1.2.3 into the file named "branding/modules/org-netbeans-core.jar/org/netbeans/core/ui/Bundle.properties" below your suite, then rebuild and run.
In NB 6.5 and later is the file location different: "branding/core/core.jar/org/netbeans/core/startup/Bundle.properties"
在您的品牌模块中,使用Bundle.properties中的Maven占位符和pom.xml中的maven-resources-plugin过滤捆绑包。
注意: Netbeans在版本控制中默认忽略下面的某些文件,因此您可能需要添加它们以保留更改。
<强>的src /主/ NBM-品牌/型芯/ core.jar添加/组织/ netbeans的/核心/启动/ Bundle.properties:强>
currentVersion=My app ${project.version}
LBL_splash_window_title=Starting My app ${project.version}
<强>的src /主/ NBM-品牌/模块/ ORG-netbeans的核 - windows.jar /组织/ netbeans的/核心/窗/视图/ UI / Bundle.properties:强>
CTL_MainWindow_Title=My app ${project.version}
CTL_MainWindow_Title_No_Project=My app ${project.version}
<强>的src /主/ NBM-品牌/模块/ ORG-netbeans的-core.jar添加/组织/ netbeans的/核心/ UI / Bundle.properties:强>
LBL_ProductInformation=My app ${project.version}
<强>的pom.xml:强>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/nbm-branding</directory>
<!-- f.e. allow replacing ${project.version} in all property files below src/main/nbm-branding -->
<includes>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
<targetPath>${basedir}/target/filtered-nbm-branding</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
<!-- use previously filtered branding sources -->
<brandingSources>${basedir}/target/filtered-nbm-branding</brandingSources>
</configuration>
</plugin>
<!-- ... -->
</plugins>
</build>
由Netbeans Dream Team成员回答。