Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

mvn command results in error in Windows

You will get error when you run following Maven command from Windows PowerShell:

PS C:\workspace> mvn -B archetype:generate -DgroupId=com.example -DartifactId=hajiboot -Dversion=1.0.0-SNAPSHOT -DarchetypeArtifactId=maven-archetype-quickstart
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.069 s
[INFO] Finished at: 2019-11-14T23:51:13+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\home\satob\workspace). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

You will see the following message with -e -X options:

PS C:\workspace> mvn -B archetype:generate -DgroupId=com.example -DartifactId=hajiboot -Dversion=1.0.0-SNAPSHOT -DarchetypeArtifactId=maven-archetype-quickstart -e -X
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-28T00:06:16+09:00)
Maven home: C:\opt\maven\bin\..
Java version: 1.8.0_212, vendor: AdoptOpenJDK, runtime: C:\opt\java\AdoptOpenJDK\8\jre
(snip)
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\home\satob\workspace). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (C:\home\satob\workspace). Please verify you invoked Maven from the correct directory.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:85)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException

To solve this problem, quote all options like:

PS C:\workspace> mvn -B archetype:generate "-DgroupId=com.example" "-DartifactId=hajiboot" "-Dversion=1.0.0-SNAPSHOT" "-DarchetypeArtifactId=maven-archetype-quickstart"

cf. https://stackoverflow.com/a/11199865/3902663

「大規模システム」の指す範囲

「100万行オーバーのモノリシックRailsアプリをマイクロサービス化したクックパッドの手順」*1では、100万行弱のコード(うちテストコードが約51万行、実行環境で動作していたのは約41万行)をもって「世界一のモノリシック」「巨大すぎる」と形容している。

また、GoogleBigtableの開発には「7人年(=84人月)の工数がかけられた」*2ということをもって、大きな工数がかかっていることが形容されている。

一方で、「みずほ35万人月」*3とか「郵政民営化1億ステップ」*4のように、SIの世界では文字通り桁の違う数字が「大規模プロジェクト」の例として挙げられる。

この感覚の差はどこから来るのだろう? ドメインモデルスタイルで設計してるシステムと、トランザクションスクリプトスタイルで設計してるシステムとの違いなのかな?

Difference of Invoke-Expression and '&' in PowerShell

# Command Result
1 Invoke-Expression 'Get-Process' OK
2 & 'Get-Process' OK
3 Invoke-Expression 'Get-Process explorer' OK
4 & 'Get-Process explorer' NG

#4 causes the following error:

& : 用語 'Get-Process explorer' は、コマンドレット、関数、スクリプト ファイル、または操作可能なプログラムの名前として認
識されません。名前が正しく記述されていることを確認し、パスが含まれている場合はそのパスが正しいことを確認してから、再試
行してください。
発生場所 行:1 文字:3
+ & 'Get-Process explorer'
+   ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-Process explorer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

新幹線の「〇〇新聞ニュース」

新幹線のドアの下に流れてる「〇〇新聞ニュース」が、同じ内容を2度流すのは、

  • (A) 一度目に流れていた内容を途中から読んだ人でも、そのまま見続けていれば読めなかった内容が読めるから。
  • (B) 文字の流れが速すぎて、一度では読めないから。

(A)とばかり思ってたんだけど、(B)と感じる人は思ってるより多いのかも。だったら単純に文字が流れる速度を変えるよねぇ、と思うんだけど、実は二度流すことで(A)と(B)の両方を解決してる可能性もあるな。

普段着と寝間着の出番

- (A) (B) (C)
かしこまった席で着る服 よそいき よそいき よそいき
学校などの日常的な場で着る服 普段着 普段着 普段着
外出しない日中に着る服 普段着 寝間着 部屋着
寝るときに着る服 寝間着 寝間着 寝間着

この「部屋着」という文化がいつ、どこから来たのか謎なんだよなぁ。

あと「よそいき」も謎。学校行事で「子供は汚れてもいい服装で来てください」と言われても、それは「動きやすい服装で来てください」と同じ意味で、汚れちゃいけない服を子供に着せるというのは意味不明だった。それに、私の小学校の卒業式(1994年)では、いわゆる「よそいき」を着ている人は少数派だった。現在の卒業式の風景は、やはりスタジオアリスの作り上げた文化なのか?