0

I am using maven for build on our purposes, I need to copy the javascript resources to a folder, can the folder name be the buildnumber , can we do this. I am planning to copy the javascript files to a folder name with build number and trying to write the build number in manifest file also to get this in JSP, could you please tell how i can implement this

    <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>     
            <version>2.6</version>      
            <executions>
            <execution>
                <id>copy-prod-resources</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <encoding>UTF-8</encoding>                  
            <configuration>
            <outputDirectory>${basedir}/target/cp/BUILD NUMBER /js</outputDirectory>
            <resources>
                <resource>
                    <directory>${basedir}/src/main/webapp/js</directory>
                    <filtering>true</filtering>
                </resource>
            </resources>
            </configuration>
            </execution>
        </executions>

can I have some way to give the build number in this logic instead of the BUILD NUMBER text

Regards Hari

user2907217
  • 137
  • 2
  • 13

2 Answers2

0

Not exactly sure what you are hinting by the build-number, Are you referring a single instance of build? or the version of project?

If it's the version of project, you can simply, define a maven property as

<properties>
  <project.buildNumber>4.5.64452</project.buildNumber> <!-- any name can be given here -->
</properties>

and use it as {project.buildNumber} where you need it in the pom.xml.

If you intend to automate the process of copying files to a specific directory on each build, have a look at the Assembly Plugin.


Not aware of any workaround or plugin that creates directory as you need. But some pointers worth exploring and hope you find it useful
- What is maven snapshot? See if you can re-use the timestamp somehow.
- One tutorial explaining this.
Community
  • 1
  • 1
mtk
  • 13,221
  • 16
  • 72
  • 112
  • Hi Mtk, the buildnumber, I meant is version number. After every build, a unique number to identify the new build.Can we set this dynamically, could you please help – user2907217 Aug 11 '14 at 10:54
0

Better approach is to make the JavaScript folder common(so that if any other project can benefit and use it) and make use of Externals like svn:externals for pulling the resources in your workspace during build process.

arjun99
  • 358
  • 1
  • 8