Continuous integration based on maven2

I am trying to figure out how to configure continuous integration using maven.

I want:

  • Check for new files in SVN
  • If changes are detected, check them.
  • Build and Deploy

I think that all this can be transferred to some kind of shell script to call its cron. Thus, we will have automatic continuous integration (for example, nightly builds)

I know that maven has an SCM plugin for working with version control systems, but I don’t know how to get it to check for changes in the repository and based on checking the results are launched.

So I ask the audience :)

PS I forgot to mention - I'm NOT INTERESTED in any of the existing applications! They are too heavy for my VPS server. Please do not advise them

+3
source share
6 answers

I would recommend using a recognized CI tool to manage this, since there is more to CI than to assembly.

But if you are determined to collapse your own, you can use some targets from the maven-scm-plugin and write the output.

Assuming you have a local copy of the project so that you can access pom, you can run the status command to check for changes, and analyze the output from checking for any changes. Purpose:

mvn scm:status

- , . , , maven-scm-provider-svn , , ! , Subversion .

, , .

mvn clean scm:checkout deploy

, scm: bootstrap . , pom .

, pom , :

mvn scm:bootstrap -DscmUserName=me -DscmPassword=mypass -DscmConnectionUrl=scm:svn:http://myserver/myproject/trunk

<project>
  [...]
  <packaging>jar</packaging>
  <version>0.0.1</version>
  <name>SCM bootstrapper</name>
  <url>http://somecompany.com</url>
  <scm>
    <connection>${scmConnectionUrl}</connection>
    <developerConnection>${scmDeveloperConnectionUrl}</developerConnection>
    <url>${scmUrl}</url>
  <scm>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <goals>install</goals>
          <username>${scmUsername}</username>
          <password>${scmPassword}</password>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
  <properties>
    <scmDeveloperConnectionUrl>dummy</scmDeveloperConnectionUrl>
    <scmConnectionUrl>dummy</scmConnectionUrl>
    <scmUrl>dummy</scmUrl>
    <scmUsername>dummy</scmUsername>
    <scmPassword>dummy</scmPassword>
  </properties>
</project>

Maven subversion, scm- POM:

<scm>
  <connection>scm:svn:http://path/to/project</connection>
  <developerConnection>scm:svn:http://path/to/project/tags/version</developerConnection>
  <url>scm:svn:http://path/to/project/tags/version</url>
</scm>

hook to subversion, . , .

+2

Hudson. , , , , Maven2 .

.

+3

Maven - . .

hudson, , , . . , , ( ).

+1
+1

JetBrains TeamCity - . , SVN Maven ( ).

0

Luntbuild, .

  • First you create a project
  • Hover over ant, maven or some other builder you are using (we just use ant-scripts)
  • Define an SVN adapter (or other VCS)

Then the application monitors the SVN for changes and creates / deploys your applications ...

0
source

Source: https://habr.com/ru/post/1713446/


All Articles