I'm working on a project that is implementing a number Java web applications (and associated JAR files) using Seam.
我正在开发一个使用Seam实现多个Java Web应用程序(和相关JAR文件)的项目。
What is considered best practice with regard to including version information in deployments? What I need to understand is how web applications should contain and publish their versions and how the same can be done for JAR files.
在部署中包含版本信息的最佳做法是什么?我需要了解的是Web应用程序应该如何包含和发布它们的版本以及如何为JAR文件完成相同的操作。
Thanks
4 个解决方案
#2
You've got a couple of options when it comes to including the version number:
在包含版本号时,您有几个选择:
- add it to the JAR's MANIFEST.INF.
- include the version of the JAR in the filename.
将它添加到JAR的MANIFEST.INF中。
在文件名中包含JAR的版本。
It's quite common to do both.
两者都很常见。
#3
As a Maven user, I follow the Maven conventions and let Maven manage all the versioning, so I end up with wars and jars with names of the form:
作为Maven用户,我遵循Maven惯例并让Maven管理所有版本控制,因此我最终得到了具有以下形式名称的战争和罐子:
foo-core-1.0.0.jar
foo-ui-1.0.0.jar
foo-app-1.1.0.war
...
Maven will also put the version information in the Manifest and embed the POM inside META_INF/maven/[groupId]/[artifactId]/pom.xml so you can determine what the original artifact depended on. This can be handy for manual verification of a live server.
Maven还会将版本信息放在Manifest中,并将POM嵌入到META_INF / maven / [groupId] / [artifactId] /pom.xml中,这样您就可以确定原始工件所依赖的内容。这对于实时服务器的手动验证非常方便。
#4
Libraries with an official version number often have it embedded in the filename.
具有正式版本号的库通常将其嵌入文件名中。
For build info, you should have an automated build process anyway, and it most likely uses ant. It is easy to:
对于构建信息,无论如何都应该有一个自动构建过程,它很可能使用ant。这很容易:
- For jar files, you can set the implementation attributes in the manifest files.
- You can create a propertyfile located in the classpath which contain the information you wish to propagate. Often you want the build time and who built it.
- For web applications you can put it in the description located in web.xml.
对于jar文件,您可以在清单文件中设置实现属性。
您可以创建位于类路径中的属性文件,其中包含您要传播的信息。通常,您需要构建时间以及构建它的人员。
对于Web应用程序,您可以将其放在web.xml中的描述中。
You can display this information in several ways:
您可以通过多种方式显示此信息:
- The description of a web app is often easily visible in the deployment environment.
- A build page showing the components used to build.
- Logging the build information to the servlet log at start up time.
Web应用程序的描述通常在部署环境中很容易看到。
构建页面,显示用于构建的组件。
在启动时将构建信息记录到servlet日志。
The essential question here is who needs to see it? End users cannot see in logs...
这里的基本问题是谁需要看到它?最终用户无法在日志中看到...
Also do not underestimate the value of an accurately kept deployment log! You should not have to go and look at the consumers files...
另外,不要低估准确保存的部署日志的价值!你不应该去查看消费者文件......
#1
there are sun specifications and tutorials.
有太阳规格和教程。
#2
You've got a couple of options when it comes to including the version number:
在包含版本号时,您有几个选择:
- add it to the JAR's MANIFEST.INF.
- include the version of the JAR in the filename.
将它添加到JAR的MANIFEST.INF中。
在文件名中包含JAR的版本。
It's quite common to do both.
两者都很常见。
#3
As a Maven user, I follow the Maven conventions and let Maven manage all the versioning, so I end up with wars and jars with names of the form:
作为Maven用户,我遵循Maven惯例并让Maven管理所有版本控制,因此我最终得到了具有以下形式名称的战争和罐子:
foo-core-1.0.0.jar
foo-ui-1.0.0.jar
foo-app-1.1.0.war
...
Maven will also put the version information in the Manifest and embed the POM inside META_INF/maven/[groupId]/[artifactId]/pom.xml so you can determine what the original artifact depended on. This can be handy for manual verification of a live server.
Maven还会将版本信息放在Manifest中,并将POM嵌入到META_INF / maven / [groupId] / [artifactId] /pom.xml中,这样您就可以确定原始工件所依赖的内容。这对于实时服务器的手动验证非常方便。
#4
Libraries with an official version number often have it embedded in the filename.
具有正式版本号的库通常将其嵌入文件名中。
For build info, you should have an automated build process anyway, and it most likely uses ant. It is easy to:
对于构建信息,无论如何都应该有一个自动构建过程,它很可能使用ant。这很容易:
- For jar files, you can set the implementation attributes in the manifest files.
- You can create a propertyfile located in the classpath which contain the information you wish to propagate. Often you want the build time and who built it.
- For web applications you can put it in the description located in web.xml.
对于jar文件,您可以在清单文件中设置实现属性。
您可以创建位于类路径中的属性文件,其中包含您要传播的信息。通常,您需要构建时间以及构建它的人员。
对于Web应用程序,您可以将其放在web.xml中的描述中。
You can display this information in several ways:
您可以通过多种方式显示此信息:
- The description of a web app is often easily visible in the deployment environment.
- A build page showing the components used to build.
- Logging the build information to the servlet log at start up time.
Web应用程序的描述通常在部署环境中很容易看到。
构建页面,显示用于构建的组件。
在启动时将构建信息记录到servlet日志。
The essential question here is who needs to see it? End users cannot see in logs...
这里的基本问题是谁需要看到它?最终用户无法在日志中看到...
Also do not underestimate the value of an accurately kept deployment log! You should not have to go and look at the consumers files...
另外,不要低估准确保存的部署日志的价值!你不应该去查看消费者文件......