我希望在执行string = input('Enter a string:')
#space for most popular character
pop_char = ''
#initialize number of times character appears
num = 0
#initialize index
index = 0
# pick one character at a time
for ch in string:
#initialize character counter
cc=0
#go through entire string and compare the character to the string characters
while index < len(string):
#if they are the same (converted to lower case), tally one to cc
if ch.lower() == string[index].lower():
cc = cc + 1
index = index + 1
#if count is greater than or equal to previous count, use this for
#popular character
if cc >= num:
num = cc
pop_char = ch
else:
index = index + 1
print('The most frequently occuring letter(s):', pop_char)
目标时排除父pom(以下代码所在的位置),我无法找到示例或自行解决:
package:copy
无论<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<classifier>shaded</classifier>
<destFileName>${project.name}.${project.packaging}</destFileName>
<excludes>*.pom</excludes> <!-- not working -->
</artifactItem>
</artifactItems>
<outputDirectory>${rootdir}/target/modules</outputDirectory>
<silent>true</silent>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
内的<excludes>
设置如何,它仍然包含我的父项目artifactItem
。我想将文件排除在复制到NiftyParent.pom
目录之外。
如果有人问,${rootdir}/target/modules
属性只指向父项目目录而没有硬编码相对/绝对路径(为了参数的原因${rootdir}
。
答案 0 :(得分:2)
您可以使用plugin的skip
配置元素以及父级及其模块中定义的Maven property
来跳过执行。
在您的父pom中,您可以将其配置如下:
<properties>
<skip-dependency-copy>true</skip-dependency-copy>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<classifier>shaded</classifier>
<destFileName>${project.name}.${project.packaging}</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${rootdir}/target/modules</outputDirectory>
<silent>false</silent>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<skip>${skip-dependency-copy}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
请注意附加属性和skip
元素配置。
然后,在每个模块中,您只需配置以下内容:
<properties>
<skip-dependency-copy>false</skip-dependency-copy>
</properties>
因此,我们实际上是根据父/模块位置打开/关闭它。这种方法的另一个优点是你也可以跳过一些模块(如果需要),并能够从命令行(覆盖已定义的属性值)通过for为所有(在你的情况下关闭)打开/关闭它实例:
mvn package -Dskip-dependency-copy=true
此方法不使用插件配置,但在许多其他插件和案例中需要跳过时,它通常会被使用。