-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "provided" classpathScope (runtime+provided)
- New "provided" value for classpathScope includes both runtime and provided dependencies - Closes #60
- Loading branch information
1 parent
d18ed80
commit ec97f4d
Showing
11 changed files
with
293 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo.exec.it</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>0.1</version> | ||
</parent> | ||
|
||
<groupId>org.codehaus.mojo.exec-maven-plugin</groupId> | ||
<artifactId>git-issue-60-exec</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- for manual tests. Can't be automated in the unit tests as the plugin's not installed. What about integration tests? --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<classpathScope>provided</classpathScope> | ||
<executable>${JAVA_HOME}/bin/java</executable> | ||
<arguments> | ||
<argument>-classpath</argument> | ||
<classpath /> | ||
<argument>gitissue60.Main</argument> | ||
</arguments> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
src/it/projects/git-issue-60-exec/src/main/java/gitissue60/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gitissue60; | ||
|
||
/* | ||
* Copyright 2005 The Codehaus. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* @version $Id$ | ||
*/ | ||
public class Main | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger( Main.class ); | ||
public static void main( String[] args ) throws Exception { | ||
LOGGER.info( "Can you hear me, Major Tom?" ); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/it/projects/git-issue-60-exec/src/main/resources/log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Root logger option | ||
log4j.rootLogger=INFO, file | ||
|
||
# Direct log messages to stdout | ||
log4j.appender.file=org.apache.log4j.FileAppender | ||
log4j.appender.file.File=exec.log | ||
log4j.appender.file.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
File execLog = new File(basedir, 'exec.log') | ||
assert execLog.exists() | ||
assert execLog.getText().contains('Can you hear me, Major Tom?') | ||
|
||
File buildLog = new File(basedir, 'build.log') | ||
assert buildLog.exists() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.debug = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.codehaus.mojo.exec.it</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>0.1</version> | ||
</parent> | ||
|
||
<groupId>org.codehaus.mojo.exec-maven-plugin</groupId> | ||
<artifactId>git-issue-60-java</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!-- for manual tests. Can't be automated in the unit tests as the plugin's not installed. What about integration tests? --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<mainClass>gitissue60.Main</mainClass> | ||
<classpathScope>provided</classpathScope> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
31 changes: 31 additions & 0 deletions
31
src/it/projects/git-issue-60-java/src/main/java/gitissue60/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gitissue60; | ||
|
||
/* | ||
* Copyright 2005 The Codehaus. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* @version $Id$ | ||
*/ | ||
public class Main | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger( Main.class ); | ||
public static void main( String[] args ) throws Exception { | ||
LOGGER.info( "Can you hear me, Major Tom?" ); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/it/projects/git-issue-60-java/src/main/resources/log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Root logger option | ||
log4j.rootLogger=INFO, file | ||
|
||
# Direct log messages to stdout | ||
log4j.appender.file=org.apache.log4j.FileAppender | ||
log4j.appender.file.File=exec.log | ||
log4j.appender.file.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
File execLog = new File(basedir, 'exec.log') | ||
assert execLog.exists() | ||
assert execLog.getText().contains('Can you hear me, Major Tom?') | ||
|
||
File buildLog = new File(basedir, 'build.log') | ||
assert buildLog.exists() | ||
def buildLogText = buildLog.getText() | ||
assert buildLogText.contains( "Adding project dependency artifact: slf4j-api to classpath" ) | ||
assert buildLogText.contains( "Adding project dependency artifact: log4j to classpath" ) | ||
assert buildLogText.contains( "Adding project dependency artifact: slf4j-log4j12 to classpath" ) | ||
assert !buildLogText.contains( "Adding project dependency artifact: junit to classpath" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters