Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-576

The build script bits that downloads and configures 1 or more managed containers should be extracted to a maven plugin, so we don't need to copy paste that logic

    Details

    • Type: Feature Request
    • Status: Coding In Progress (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Maven Plugin
    • Labels:
      None

      Description

      See ARQ-574.

      Now we have to copy paste something like this, per managed container:

        <properties>
          <managed-appserver.download.dir>${project.basedir}/local/managed-appserver</managed-appserver.download.dir>
          <managed-appserver.tomcat6.version>6.0.33</managed-appserver.tomcat6.version>
          <managed-appserver.tomcat6.home>${project.build.directory}/apache-tomcat-${managed-appserver.tomcat6.version}</managed-appserver.tomcat6.home>
        </properties>
      ...
            <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <inherited>false</inherited>
              <executions>
                <execution><!-- For managed tomcat -->
                  <phase>generate-test-resources</phase>
                  <configuration>
                    <target>
                      <mkdir dir="${managed-appserver.download.dir}"/>
                      <get
                          src="http://archive.apache.org/dist/tomcat/tomcat-6/v${managed-appserver.tomcat6.version}/bin/apache-tomcat-${managed-appserver.tomcat6.version}.zip"
                          dest="${managed-appserver.download.dir}" verbose="true" skipexisting="true"/>
                      <unzip src="${managed-appserver.download.dir}/apache-tomcat-${managed-appserver.tomcat6.version}.zip"
                             dest="${project.build.directory}"/>
                    </target>
                  </configuration>
                  <goals>
                    <goal>run</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <executions>
                <execution>
                  <id>copy-resources</id>
                  <phase>process-test-resources</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${managed-appserver.tomcat6.home}/conf</outputDirectory>
                    <overwrite>true</overwrite>
                    <resources>
                      <resource>
                        <directory>${basedir}/src/test/conf/tomcat6</directory>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <environmentVariables>
                  <CATALINA_HOME>${managed-appserver.tomcat6.home}</CATALINA_HOME>
                </environmentVariables>
              </configuration>
            </plugin>
      

      But this changes over time, and since we copy-paste it to our user projects, our copy becomes stale.
      If this could be extracted somehow (aslak is not in favor of adding this to the managed container runtimes, so probably a maven plugin),
      that would be nice.

      Extra optional requirements:

      • It should be easy to ask for multiple managed appservers (say jboss 7, tomcat 6, jetty 6 and jboss 6)
      • Prefer zips from the maven repo over "download" url's. At least if the maven repo is down we know that a clean build doesn't work.
      • What if multiple hudson jobs are testing with arq on the same hudson slave? They can't use the same port!
      • I prefer downloading to /local instead of /target, because the latter gets deleted during "mvn clean". Then again, if it comes from ~/.m2/repository, neither is needed.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            aslak Aslak Knutsen added a comment -

            This should reuse the same Container API as The Forge Arquillian plugin, https://github.com/forge/plugin-arquillian/blob/master/src/main/resources/containers.json

            (to be published under arquillian.org/api/container.json)

            Show
            aslak Aslak Knutsen added a comment - This should reuse the same Container API as The Forge Arquillian plugin, https://github.com/forge/plugin-arquillian/blob/master/src/main/resources/containers.json (to be published under arquillian.org/api/container.json)
            Hide
            dan.j.allen Dan Allen added a comment -

            I'm really beginning to think that downloading the container is something that the managed adapters should be able to do. We can put a lot more intelligence into the Java code than a developer can put into a build script.

            We can still use something like ShrinkWrap Resolvers to find the container bits via the Maven repositories (remote or local), but I think we should do something here that is more transparent than even a Maven plugin. If we really want to be able to skip the build, then we can't be relying on the Maven lifecycle to handle this for us.

            Managed should be managed. Not half managed.

            ...I do agree that we can leverage the container metadata to avoid hardcoding any download paths into the adapter. In fact, I should stress the point. Don't hardcode URLs into the adapters.

            Show
            dan.j.allen Dan Allen added a comment - I'm really beginning to think that downloading the container is something that the managed adapters should be able to do. We can put a lot more intelligence into the Java code than a developer can put into a build script. We can still use something like ShrinkWrap Resolvers to find the container bits via the Maven repositories (remote or local), but I think we should do something here that is more transparent than even a Maven plugin. If we really want to be able to skip the build, then we can't be relying on the Maven lifecycle to handle this for us. Managed should be managed. Not half managed. ...I do agree that we can leverage the container metadata to avoid hardcoding any download paths into the adapter. In fact, I should stress the point. Don't hardcode URLs into the adapters.
            Hide
            ge0ffrey Geoffrey De Smet added a comment -

            @Dan +10 to whatever stops us (the users) of having to reinvent the wheel in each of our build scripts to do make it work
            +1 that it needs to work in intellij/eclipse/netbeans too by skipping the build - which indeed makes it a better idea to do in arquillian itself during the test suite setup

            The downloadUrl should it indeed be configurable, but it would be nice if arquillian comes with a community-maintained mapping from appServerVersion (managed server gav?) to downloadUrl, which makes configuring that downloadUrl optional (configuration by exception).

            Show
            ge0ffrey Geoffrey De Smet added a comment - @Dan +10 to whatever stops us (the users) of having to reinvent the wheel in each of our build scripts to do make it work +1 that it needs to work in intellij/eclipse/netbeans too by skipping the build - which indeed makes it a better idea to do in arquillian itself during the test suite setup The downloadUrl should it indeed be configurable, but it would be nice if arquillian comes with a community-maintained mapping from appServerVersion (managed server gav?) to downloadUrl, which makes configuring that downloadUrl optional (configuration by exception).
            Hide
            dan.j.allen Dan Allen added a comment -

            My thoughts exactly.

            Show
            dan.j.allen Dan Allen added a comment - My thoughts exactly.
            Hide
            davided80 Davide D'Alto added a comment -

            @Dan I personally would love a maven plugin for this operations but I'm not sure what you are suggesting.

            I would like to start to develop a prototype. This is something that I always miss when I use arquillian.

            Initially, I was thinking something like this:

            ...
            <plugin>
                <groupId>org.jboss.arquillian.maven</groupId>
                <artifactId>arquillian-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <id>download-containers</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>download</goal>
                        </goals>
                        <containers>
                            <container>
            		    <id>jbossas-managed</id>
            		    <version>7.1.1.Final</version>
            		    <addDependencies>true</addDependencies>
            		    <downloadContainer>true</downloadContainer>
                                <targetDir><targetDir>
            		    <downloadUrl></downloadUrl>
            	        </container>
                        </containers>
                   </execution>
            </plugin>
            ...
            

            id: e.g. jbossas-managed, jetty-embedded, glassfish-remote, ...
            addDependencies: if true will add the dependencies required to use arquillian
            downloadContainer: if you want to download the corresponding container.
            targetDir: location where to unpack the downloaded container
            downloadUrl: url where the compress container is located (only if you don't want to use the default one in the containers.json file)

            They could use some sensible default. For example if you specify the url anything else could be optional unless you need to add the dependencies on the classpath.

            Let me know what do you think.

            Show
            davided80 Davide D'Alto added a comment - @Dan I personally would love a maven plugin for this operations but I'm not sure what you are suggesting. I would like to start to develop a prototype. This is something that I always miss when I use arquillian. Initially, I was thinking something like this: ... < plugin > < groupId >org.jboss.arquillian.maven</ groupId > < artifactId >arquillian-maven-plugin</ artifactId > < version >${project.version}</ version > < executions > < execution > < id >download-containers</ id > < phase >initialize</ phase > < goals > < goal >download</ goal > </ goals > < containers > < container > < id >jbossas-managed</ id > < version >7.1.1.Final</ version > < addDependencies >true</ addDependencies > < downloadContainer >true</ downloadContainer > < targetDir >< targetDir > < downloadUrl ></ downloadUrl > </ container > </ containers > </ execution > </ plugin > ... id: e.g. jbossas-managed, jetty-embedded, glassfish-remote, ... addDependencies: if true will add the dependencies required to use arquillian downloadContainer: if you want to download the corresponding container. targetDir: location where to unpack the downloaded container downloadUrl: url where the compress container is located (only if you don't want to use the default one in the containers.json file) They could use some sensible default. For example if you specify the url anything else could be optional unless you need to add the dependencies on the classpath. Let me know what do you think.

              People

              • Assignee:
                davided80 Davide D'Alto
                Reporter:
                ge0ffrey Geoffrey De Smet
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Development