"header specification is not a regular expression: InvocationTargetException"的原因是什么
What's the reason for "header specification is not a regular expression: InvocationTargetException"
我是 运行 maven-checkstyle-plugin
2.15,具有以下规格的 header 检查
<module name="RegexpHeader">
<property
name="header"
value="^<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the "License"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.-->.*"/>
<property name="fileExtensions" value="xml"/>
</module>
<module name="RegexpHeader">
<property
name="header"
value="^/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the "License"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"/>
<property name="fileExtensions" value="java"/>
</module>
什么可能导致错误 line 1 in header specification is not a regular expression: InvocationTargetException
?没有什么可尝试的,因为插件不会告诉真正的错误(可能 return 解析器错误详细信息或任何有用的信息)。
完整的错误是
Failed during checkstyle configuration: cannot initialize module RegexpHeader - Cannot set property 'header' in module RegexpHeader to '^/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the "License"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.*': line 1 in header specification is not a regular expression: InvocationTargetException -> [Help 1]
一些未转义字符的实际原因,例如正则表达式中的 *
。
maven-checkstyle-plugin
调用checkstyle
的反馈不是很好。我改进了代码以显示模式编译的错误消息并在 https://github.com/checkstyle/checkstyle/pull/897.
请求合并
我是 运行 maven-checkstyle-plugin
2.15,具有以下规格的 header 检查
<module name="RegexpHeader">
<property
name="header"
value="^<!--\n Licensed to the Apache Software Foundation (ASF) under one or more\n contributor license agreements. See the NOTICE file distributed with\n this work for additional information regarding copyright ownership.\n The ASF licenses this file to You under the Apache License, Version 2.0\n (the "License"); you may not use this file except in compliance with\n the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.-->.*"/>
<property name="fileExtensions" value="xml"/>
</module>
<module name="RegexpHeader">
<property
name="header"
value="^/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the "License"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"/>
<property name="fileExtensions" value="java"/>
</module>
什么可能导致错误 line 1 in header specification is not a regular expression: InvocationTargetException
?没有什么可尝试的,因为插件不会告诉真正的错误(可能 return 解析器错误详细信息或任何有用的信息)。
完整的错误是
Failed during checkstyle configuration: cannot initialize module RegexpHeader - Cannot set property 'header' in module RegexpHeader to '^/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the "License"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */.*': line 1 in header specification is not a regular expression: InvocationTargetException -> [Help 1]
一些未转义字符的实际原因,例如正则表达式中的 *
。
maven-checkstyle-plugin
调用checkstyle
的反馈不是很好。我改进了代码以显示模式编译的错误消息并在 https://github.com/checkstyle/checkstyle/pull/897.