You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@archiva.apache.org by Olivier Lamy <ol...@apache.org> on 2011/05/06 15:26:11 UTC

Re: svn commit: r1099827 - in /archiva/trunk: ./ archiva-modules/archiva-web/archiva-applet/ archiva-modules/archiva-web/archiva-webapp/ archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/ archiva-modules/archiva-web/archiv

The goal of this patch is to be able to use tomcat:run from the top of
the project without installing all artifacts first (definitely io/time
saving :-) )
Note it works really well with maven3 as maven3 see build output
directory of reactor modules.

So just touch something in a module and run (from the top) : mvn
tomcat:run -Pdev and hit your browser to http://localhost:9091/archiva

2011/5/6 Brett Porter <br...@apache.org>:
>
> On 06/05/2011, at 12:42 AM, wsmoak@apache.org wrote:
>
>>
>> Modified: archiva/trunk/archiva-modules/archiva-web/archiva-applet/pom.xml
>> URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-applet/pom.xml?rev=1099827&r1=1099826&r2=1099827&view=diff
>> ==============================================================================
>> --- archiva/trunk/archiva-modules/archiva-web/archiva-applet/pom.xml (original)
>> +++ archiva/trunk/archiva-modules/archiva-web/archiva-applet/pom.xml Thu May  5 14:42:00 2011
>> @@ -86,4 +86,26 @@
>>       </plugin>
>>     </plugins>
>>   </build>
>> +  <profiles>
>> +    <profile>
>> +      <id>dev</id>
>> +      <build>
>> +        <plugins>
>> +          <plugin>
>> +            <groupId>org.apache.maven.plugins</groupId>
>> +            <artifactId>maven-jar-plugin</artifactId>
>> +            <executions>
>> +              <execution>
>> +                <id>jar-generate-for-dev</id>
>> +                <phase>compile</phase>
>> +                <goals>
>> +                  <goal>jar</goal>
>> +                </goals>
>> +              </execution>
>> +            </executions>
>> +          </plugin>
>> +        </plugins>
>> +      </build>
>> +    </profile>
>> +  </profiles>
>> </project>
>
> I'm unclear what this does?
My bad didn't remove some tests
>
>>
>> Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
>> URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=1099827&r1=1099826&r2=1099827&view=diff
>> ==============================================================================
>> --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
>> +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml Thu May  5 14:42:00 2011
>>
>> @@ -571,5 +598,118 @@
>>         </plugins>
>>       </build>
>>     </profile>
>> +    <profile>
>> +      <!-- profile for tomcat plugin dev an log output in the console -->
>> +      <id>dev</id>
>> +      <build>
>> +        <plugins>
>> +          <plugin>
>> +            <artifactId>maven-antrun-plugin</artifactId>
>> +            <executions>
>> +              <execution>
>> +                <id>override-log4j-with-console-output</id>
>> +                <phase>process-resources</phase>
>> +                <goals>
>> +                  <goal>run</goal>
>> +                </goals>
>> +                <configuration>
>> +                  <tasks>
>> +
>> +                    <copy overwrite="true" file="${basedir}/src/test/resources/log4j.xml" todir="${basedir}/src/main/webapp/WEB-INF/classes" />
>
> Does it have to be into the source tree? That's a bit gross :)
yup need to svn:ignore ${basedir}/src/main/webapp/WEB-INF/classes
but the below copy ${project.build.directory}/classes do the trick in fact
>
>> +
>> +                                               <copy overwrite="true" file="${basedir}/src/test/resources/log4j.xml" todir="${project.build.directory}/classes" />
>> +                  </tasks>
>> +                </configuration>
>> +              </execution>
>> +            </executions>
>> +          </plugin>
>> +          <plugin>
>> +            <groupId>org.apache.maven.plugins</groupId>
>> +            <artifactId>maven-dependency-plugin</artifactId>
>> +            <version>2.2</version>
>> +            <executions>
>> +              <execution>
>> +                <id>copy</id>
>> +                <phase>process-resources</phase>
>> +                <goals>
>> +                  <goal>copy</goal>
>> +                </goals>
>> +                <configuration>
>> +                  <skip>true</skip>
>> +                  <artifactItems>
>> +                    <artifactItem>
>> +                      <groupId>${project.groupId}</groupId>
>> +                      <artifactId>archiva-applet</artifactId>
>> +                      <version>${project.version}</version>
>> +                      <outputDirectory>src/main/webapp</outputDirectory>
>> +                      <destFileName>archiva-applet.jar</destFileName>
>> +                    </artifactItem>
>> +                  </artifactItems>
>> +                </configuration>
>> +              </execution>
>
> Isn't this already done earlier?
Note the <skip> here :-)
Basically tomcat:run with the applet won't work (when you run on the top).
Because with maven3 the artifact is resolved to the
buid.outputDirectory of the reactor  module (so skip it )

>
>> +              <execution>
>> +                <id>unpack-redback-war</id>
>> +                <goals>
>> +                  <goal>unpack</goal>
>> +                </goals>
>> +                <phase>compile</phase>
>> +                <configuration>
>> +                  <artifactItems combine.self="override">
>> +                    <artifactItem>
>> +                      <groupId>org.codehaus.redback</groupId>
>> +                      <artifactId>redback-struts2-content</artifactId>
>> +                      <version>${redback.version}</version>
>> +                      <type>war</type>
>> +                      <overWrite>false</overWrite>
>> +                      <outputDirectory>${basedir}/src/main/webapp</outputDirectory>
>> +                      <excludes>**/web.xml,lib</excludes>
>> +                    </artifactItem>
>> +                  </artifactItems>
>> +                </configuration>
>> +              </execution>
>> +            </executions>
>> +          </plugin>
>
> This doesn't work with the overlays?

Note the combine.self="override" attribute.
Because this execution in the default profile exclude :
struts-security.xml (and it's needed here :-) )
>
>> +
>> +          <!--plugin>
>> +            <groupId>org.apache.maven.plugins</groupId>
>> +            <artifactId>maven-resources-plugin</artifactId>
>> +            <version>2.5</version>
>> +            <executions>
>> +              <execution>
>> +                <id>copy-redback-resources</id>
>> +                <phase>compile</phase>
>> +                <goals>
>> +                  <goal>copy-resources</goal>
>> +                </goals>
>> +                <configuration>
>> +                  <outputDirectory>${project.build.outputDirectory}</outputDirectory>
>> +                  <resources>
>> +                    <resource>
>> +                      <directory>${basedir}/src/main/webapp/WEB-INF/classes</directory>
>> +                      <filtering>false</filtering>
>> +                      <includes>
>> +                        <include>struts-security.xml</include>
>> +                      </includes>
>> +                    </resource>
>> +                  </resources>
>> +                </configuration>
>> +              </execution>
>> +            </executions>
>> +          </plugin-->
>
> Meant to be here?

my bad didn't remove a commented part.

>
>> +        </plugins>
>> +      </build>
>> +      <dependencies>
>> +        <dependency>
>> +          <groupId>org.apache.archiva</groupId>
>> +          <artifactId>metadata-store-file</artifactId>
>> +          <version>${project.version}</version>
>> +        </dependency>
>> +        <dependency>
>> +          <groupId>org.codehaus.redback</groupId>
>> +          <artifactId>redback-struts2-integration</artifactId>
>> +          <version>${redback.version}</version>
>> +        </dependency>
>> +      </dependencies>
>> +    </profile>
>
> Aren't these already declared earlier?
>>
>>
>> Added: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml
>> URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml?rev=1099827&view=auto
>> ==============================================================================
>> --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml (added)
>> +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/tomcat-context-archiva.xml Thu May  5 14:42:00 2011
>> @@ -0,0 +1,37 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> +  ~ Licensed to the Apache Software Foundation (ASF) under one
>> +  ~ or more contributor license agreements.  See the NOTICE file
>> +  ~ distributed with this work for additional information
>> +  ~ regarding copyright ownership.  The ASF licenses this file
>> +  ~ to you under the Apache License, Version 2.0 (the
>> +  ~ "License"); you may not use this file except in compliance
>> +  ~ with the License.  You may obtain a copy of the License at
>> +  ~
>> +  ~   http://www.apache.org/licenses/LICENSE-2.0
>> +  ~
>> +  ~ Unless required by applicable law or agreed to in writing,
>> +  ~ software distributed under the License is distributed on an
>> +  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +  ~ KIND, either express or implied.  See the License for the
>> +  ~ specific language governing permissions and limitations
>> +  ~ under the License.
>> +  -->
>> +  <Context path="/continuum">
>> +    <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
>> +              username="sa"
>> +              password=""
>> +              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
>> +              url="jdbc:derby:${catalina.base}/target/database/users;create=true"
>> +    />
>> +    <Resource name="jdbc/continuum" auth="Container" type="javax.sql.DataSource"
>> +              username="sa"
>> +              password=""
>> +              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
>> +              url="jdbc:derby:${catalina.base}/target/database/continuum;create=true"
>> +    />
>> +    <Resource name="mail/Session" auth="Container"
>> +            type="javax.mail.Session"
>> +            mail.smtp.host="localhost"/>
>> +
>> +</Context>
>
> jdbc/continuum isn't needed :)
dohh
>
> - Brett
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
> http://au.linkedin.com/in/brettporter
>
>
>
>
>



-- 
Olivier Lamy
http://twitter.com/olamy
http://www.linkedin.com/in/olamy