I'm new to Maven and we want a way to use checksums to determine when files have been changed in SVN for troubleshooting deployment purposes. We have 2 artifacts that are deployed in our respective environments:
(a) 1 WAR file
(b) 1 configuration folder containing a few .properties files and a few XML files.
We want to track if any of the config files have been modified since building the original WAR file since sometimes developers have added configuration entries that are no longer in synch with the WAR file. We think the ability to compare check sums might be a good help in this area. We use Maven as our build tool and JBoss is our app server.
In pom.xml I added a entry for the maven-install-plugin. When I perform a build using "maven clean package" and then a hard deploy to JBoss by Maven "mvn jboss:hard-deploy" I don't see any specific check sums files.
pom.xml entry for maven-install-plugin contains a element which contains a element that contains a text value of true. According to documentation I have widely read this should generate check sum files. I have searched for these check sum files after both the build and deploy to JBoss. I'm new to Maven and checksums and I have searched online for the last few days unsuccessfully so that is the only reason I'm reaching out for help.
Thanks in advance to anyone who can help,
-Kevin
Related
I have maven-base ear file.
The ear contains lot of jars the built by same CI-CD process - monolith.
I have implementation of incremental build, that improve the CI-CD times by build the artifacts that changed or affected only. and take the other artifacts from artifactory.
The problem is - when I start new version, I have to build all the artifacts in order to create the artifacts in artifactory the first time. This takes long of time.
Is there a quick way to copy all the artifacts from version 0.1 to version 0.2 in artifactory?
In the beginning of version 0.2, The artifacts are the same.
Thanks
TL;DR
It's not that straight forward.
Personally I think it's not the right way to go. You should probably break your internal dependencies based on their lifecycles, and reuse existing versions instead of rebuilding them.
In more details:
Technically, you can use the JFrog CLI's copy command to copy files in Artifactory. You can also use the Copy Item API directly if you prefer. Copy is a cheap and quick operation in Artifactory because of its checksum based storage (the content is stored only once).
But, that's not enough, mainly because of Maven.
Maven uses a file path format which contains the version - both as a folder and in the file names. The Maven artifacts file path format is (simplified): /<group>/<artifact>/<version>/<artifact>-<version>.<ext>. For example, the jar file of the artifact org.acme:foo:0.1 will have a file like: /org/acme/foo/0.1/foo-0.1.jar.
It means that copying files from folder of 0.1 to 0.2 is not enough, you also need to rename them accordingly.
And that's still not enough - Maven also embeds the the version in files, mainly in the pom file. It means that copying it is also not enough, you need to modify the content of that xml file.
But, it also depends on how you use Artifactory. The best practice is to publish also a build-info when you upload to Artifactory. That usually means that Artifactory stores properties on the files, properties which are specific to the build as part of which they were created and uploaded. These properties are also copied as part of the copy operation mentioned above, and you should remove them from the new version.
To do all of that you can probably write a simple script which lists the files, copy and rename the files, adjust the content of the pom file, and remove the properties.
I'm working in a complex tomcat configuration where I'm using third party proprietary service that is distributed as WARs. In the servlet container I have 10 WARs deployed where only one is coded by us.
We are using maven to manage the project.
I'm declaring the third party WAR files in the POM with provided scope.
My issue comes when I try to use maven to deploy the system in a local testing server.
I'm using maven-dependency-plugin:copy-dependencies goal to copy the right artifacts in the right directories in the local serving tester.
I must copy JAR files in one directory and WAR files to a different directory. But maven is not differentiating the artifacts by packaging. So I end having the JARs mixed with the WARs in the destination directory. While I need to have two executions, one for WARs and one for JARs going to the right directory.
I have only being able to use a copy goal specifying every artifact to copy, but this is difficult to maintain if any developer adds a new dependency, the dependency must also be added to the right copy goal.
I will like to be able to use copy-dependencies goal but being able to indicate that I only want to copy a specific packaging.
Any idea on how I can manage to do that?
Thanks!
You can use -DexcludeTypes=war
https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#excludeTypes
I am using alfresco 4.1.3 having following project structure.
I am using the ant script to build project.
Now I want to convert this project into maven based alfresco5.
I have configured alfresco5 using all-in-one archetype and I am able to run it successfully. My questions are:
How can I convert my alfresco ant based project in alfresco5 maven based?
Do I need to add src files in repo or repo-amp?
Do I need to copy all share related files in share or share-amp?
Any help would be greatly appreciated!!!
Thanks in Advance.!!
That totally depends on the ant build setup. But one good guess is that you will have to put the files residing in the "Alfresco" folder of your old project into different subfolders of the repo-amp, and the same way around with the "Share" folder. Most files will go into those folders, you have to study the SDK-docs carefully to know into which folders the files will go. Depending of the nature of your extensions some files could go into the Share and Alfresco war-structure as well (additions to web.xml for example).
There are no "Swiss army knife" for that works for all cases here.
Good luck
Do the following things:
Create new project as maven project and provide group id (it's yours) artifact id as alfresco5 and version (ex:43.0.1-SNAPSHOT)
With this it creates maven based folder structure
src/main/java -> replace it with your src folder
3.src/main/resources ->add your Share, reference and Alfresco folders.
look at you lib directory..what ever .jar will be there you need to define it in dependencies under pom.xml
compile the whole project..if there are compilation errors then add required dependencies in pom.xml
I apologize that this is surely basic maven/war plugin stuff, but I'm totally not a maven user. I just have to hack this one thing into a project that is maven based.
What I need to do is to copy an (essentially arbitrary) directory and files into the root of my war. I need them to appear as resources available via HTTP when the war deploys.
I cannot simply put them in the "right place" in the source tree. This is because the files in question are actually the source files of my project. I realize this is a bit odd, but this is a documentation project, and I need to show the source and the effect all in the same war.
So, in the general case, how would I configure the maven war plugin to copy a given directory, along with it's contents, to the root of my war? (BTW, I have tried to make sense of the documentation of this tool, but it seems to be predicated on so much understanding of maven that it feels like I'll never understand it without learning maven first, and I'm a bit too pressed for time to do that just now!)
Many TIA
Toby.
You could try:
use the copy-resources plugin. Use the plugin to copy your source files under target prior to when the war is packaged.
or, configure the maven-war-plugin to include additional resources.
Thanks Drew, that got me where I needed to go. Bottom line, I added the sample pom fragment from the link you gave for copy-resources to my pom.xml with the following changes:
<outputDirectory>target/${project.name}-${project.version}/sources ...
<directory>src/main/java ...
I copied this from the link you gave, then edited the element to point at src/main/java, which picked up my files, and the outputDirectory to the aggregate target/${project.name}-${project.version}/sources . I found that ${project.name} mapped to the project, and the version came from ${project.version}, which seemed to resolve the last little bits of issue.
Thanks again.
Toby
I have a maven project and respective pom.xml files. it is just a ear file, which is getting generated with my proejct name. but i want it dyanmic with projectname_datetime.ear file using pom.xml. Can you please give me a static example which will create a ear file with current dateand time of build number with major_minor or something link that.
Thanks in Advance.
Nilesh
See this answer: https://stackoverflow.com/a/2077869/116509. You'll also need to add
<build>
<finalName>${project.artifactId}-${project.version}-${maven.build.timestamp}
</finalName>
However you should use probably be using -SNAPSHOT version numbers during development. If you want to be able to a refer to a definitive version, you can release that version. It's also possible to refer to a specific snapshot, see http://mojo.codehaus.org/versions-maven-plugin/examples/lock-snapshots.html.
If you are using svn for your source code management, Codehaus' buildnumber-maven-plugin may be used to put the svn revision number into the manifest of any artifact you build, including snapshots. The plugin has a goal to format timestamps too, if you need it.