Skip to content

Instantly share code, notes, and snippets.

@pdudits
Created March 29, 2012 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdudits/2243895 to your computer and use it in GitHub Desktop.
Save pdudits/2243895 to your computer and use it in GitHub Desktop.
depswitch
/api-dev/target/
/api-deploy/target/
/application/target/
package net.dudits.depswitch.application;
import net.dudits.depswitch.api.Constants;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "This application is meant for "+Constants.PURPOSE );
}
}
package net.dudits.depswitch.api;
/**
* Imagine e. g. JNDI names used e. g. in {@code @EJB(lookup=)} annotations.
* @author Patrik
*/
public class Constants {
public static final String PURPOSE="deployment";
}
package net.dudits.depswitch.api;
/**
* Imagine e. g. JNDI names used e. g. in {@code @EJB(lookup=)} annotations.
* @author Patrik
*/
public class Constants {
public static final String PURPOSE="development";
}
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.dudits.depswitch</groupId>
<artifactId>depswitch</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>api-deploy</artifactId>
<name>api-deploy</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.dudits.depswitch</groupId>
<artifactId>depswitch</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>api-dev</artifactId>
<name>api-dev</name>
</project>
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.dudits.depswitch</groupId>
<artifactId>depswitch</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>application</artifactId>
<name>application</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>net.dudits.depswitch.application.App</mainClass>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>net.dudits.depswitch</groupId>
<artifactId>api-dev</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>deploy</id>
<dependencies>
<dependency>
<groupId>net.dudits.depswitch</groupId>
<artifactId>api-deploy</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classifier>deploy</classifier>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.dudits.depswitch</groupId>
<artifactId>depswitch</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>depswitch</name>
<description>Switch dependencies based on profiles</description>
<modules>
<module>api-dev</module>
<module>api-deploy</module>
<module>application</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.dudits.depswitch</groupId>
<artifactId>api-dev</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.dudits.depswitch</groupId>
<artifactId>api-deploy</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment